Page MenuHomePhorge

PHP 8.1 "str_replace(null)" exception in DivinerAtomRef
Closed, ResolvedPublic

Description

  1. PHP 8.3.10; Phorge at b74f1ad519e8a0d07dc1136f5927cd58d9aed8e5
  2. Go to http://phorge.localhost/diviner/find/
[2024-08-11 14:59:54] ERROR 8192: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated at [/var/www/html/phorge/phorge/src/applications/diviner/atom/DivinerAtomRef.php:205]
arcanist(head=master, ref.master=84210cedc6ce), ava(head=wmf/stable, ref.master=d3f5a1c67bb4, ref.wmf/stable=0b414fb56fe3), phorge(head=T15910divinerStrlen, ref.master=b74f1ad519e8, ref.T15910divinerStrlen=b213a1c283c6), translations(head=wmf/stable, ref.master=09fe573a932a, ref.wmf/stable=ad3c1bb2af60)
  #0 str_replace(string, string, NULL) called at [<phorge>/src/applications/diviner/atom/DivinerAtomRef.php:205]
  #1 DivinerAtomRef::normalizeTitleString(NULL) called at [<phorge>/src/applications/diviner/query/DivinerAtomQuery.php:344]
  #2 DivinerAtomQuery::buildWhereClause(AphrontMySQLiDatabaseConnection) called at [<phorge>/src/applications/diviner/query/DivinerAtomQuery.php:132]
  #3 DivinerAtomQuery::loadPage() called at [<phorge>/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php:251]
  #4 PhabricatorPolicyAwareQuery::execute() called at [<phorge>/src/applications/diviner/controller/DivinerFindController.php:62]
  #5 DivinerFindController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #6 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:203]
  #7 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

Urgh. In calling https://we.phorge.it/source/phorge/browse/master/src/applications/diviner/query/DivinerAtomQuery.php$340 , $this->titles is an array which has a length of 1, with its only member being null. Sounds like there's already something fishy before.

aklapper renamed this task from PHP 8.1 "strlen(null)" exception in DivinerAtomRef to PHP 8.1 "str_replace(null)" exception in DivinerAtomRef.Aug 11 2024, 15:38

After looking again here:

https://we.phorge.it/source/phorge/browse/master/src/applications/diviner/controller/DivinerFindController.php;66bd13b193b666e77c00ccea0fea508134c5397a$61

I'm even more sure we should just wrap line 61 inside an if (phutil_nonempty_string($query_text)) and probably just that