Page MenuHomePhorge

PHP 8.2 bug report "strlen() null exception" when using the top bar search tool
Closed, ObsoletePublic

Asked by bob on Aug 7 2023, 14:56.

Details

When I use the top search bar in my Phorge instance powered by PHP 8.2, I get the following error :

Stack:

EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261];
PHP message: arcanist(head=master, ref.master=6e4947b55f09), phorge(head=master, ref.master=7bebfa289aa1);
PHP message: #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/search/controller/PhabricatorSearchController.php:16];
PHP message: #1 <#2> PhabricatorSearchController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284];
PHP message: #2 phlog(RuntimeException) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41];
PHP message: #3 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751];
PHP message: #4 AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296];
PHP message: #5 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:203];
PHP message: #6 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]

Version :

Phorge : 7bebfa289aa1
Arcanist : 6e4947b55f09

Step to reproduce :

  1. Sign in
  2. Fill something in the top bar search field (whatever the search options)
  3. Got a RuntimeException

Suggested patch:

diff --git a/src/applications/search/controller/PhabricatorSearchController.php b/src/applications/search/controller/PhabricatorSearchController.php
index b3d3ab18fa..336604d228 100644
--- a/src/applications/search/controller/PhabricatorSearchController.php
+++ b/src/applications/search/controller/PhabricatorSearchController.php
@@ -13,7 +13,7 @@ final class PhabricatorSearchController
     $viewer = $this->getViewer();
     $query = $request->getStr('query');
 
-    if ($request->getStr('jump') != 'no' && strlen($query)) {
+    if ($request->getStr('jump') != 'no' && phutil_nonempty_string($query)) {
       $jump_uri = id(new PhabricatorDatasourceEngine())
         ->setViewer($viewer)
         ->newJumpURI($query);

By the way, thanks for maintaining this fantastic tool !

Answers

valerio.bozzolan
Updated 501 Days Ago

Welcome in Phorge!

This question seems a legitimate and lovely Bug Reports that can be copy-pasted as Sub-Task of this:

T15064: Make Phorge compatible with PHP 8.1/8.2/8.3/8.4

If you do that, feel free to close this question as Obsolete :)

Also feel free to submit your Patch in Differential. For example, you can run arc diff to do that. In that way, a Blessed Committers will review that ASAP :) This is the preferred way, so that your contribution credit is preserved forever in git.

Ah, you are now a Trusted Contributors so you can really do that!

Available for clarifications in the chat Z1

bob
Updated 501 Days Ago

Great, and thanks for including me in Trusted Contributors group. As sugested, I've created the sub-task T15595 and the differential D25380.

New Answer

Answer

This question has been marked as closed, but you can still leave a new answer.