Page MenuHomePhorge

PHP 8.1 strlen(null) and mb_detect_encoding(null) exceptions creating a Diffusion Identity without entering assignee
Closed, ResolvedPublic

Description

  1. PHP 8.2.6; Phorge at cbc0e661544a31290099ab3d88481bb8d4a3003c
  2. Go to http://phorge.localhost/diffusion/identity/
  3. Select Create Identity in upper right corner to go to http://phorge.localhost/diffusion/identity/edit/form/default/
  4. Select the Create Identity button without entering anything in the Assigned To field
[2023-06-02 17:26:36] EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=b325304b6e52), phorge(head=diffusionCreateIdentity, ref.master=cbc0e661544a, ref.diffusionCreateIdentity=cbc0e661544a)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/repository/xaction/PhabricatorRepositoryIdentityAssignTransaction.php:55]
  #1 <#2> PhabricatorRepositoryIdentityAssignTransaction::validateTransactions(PhabricatorRepositoryIdentity, array) called at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:2871]
  #2 <#2> PhabricatorApplicationTransactionEditor::validateTransaction(PhabricatorRepositoryIdentity, string, array) called at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:1234]
  #3 <#2> PhabricatorApplicationTransactionEditor::applyTransactions(PhabricatorRepositoryIdentity, array) called at [<phorge>/src/applications/transactions/editengine/PhabricatorEditEngine.php:1149]
  #4 <#2> PhabricatorEditEngine::buildEditResponse(PhabricatorRepositoryIdentity) called at [<phorge>/src/applications/transactions/editengine/PhabricatorEditEngine.php:1000]
  #5 <#2> PhabricatorEditEngine::buildResponse() called at [<phorge>/src/applications/diffusion/controller/DiffusionIdentityEditController.php:9]
  #6 <#2> DiffusionIdentityEditController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #7 phlog(RuntimeException) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
  #8 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #9 AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #10 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:203]
  #11 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]

Fix that exception; try again, get next exception:

[2023-06-02 17:29:15] EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=b325304b6e52), phorge(head=diffusionCreateIdentity, ref.master=cbc0e661544a, ref.diffusionCreateIdentity=cbc0e661544a)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php:298]
  #1 <#2> PhabricatorLiskDAO::getUTF8StringFromStorage(NULL, NULL) called at [<phorge>/src/applications/repository/storage/PhabricatorRepositoryIdentity.php:57]
  #2 <#2> PhabricatorRepositoryIdentity::getIdentityName() called at [<phorge>/src/applications/repository/storage/PhabricatorRepositoryIdentity.php:63]
  #3 <#2> PhabricatorRepositoryIdentity::getIdentityEmailAddress() called at [<phorge>/src/applications/repository/storage/PhabricatorRepositoryIdentity.php:111]
  #4 <#2> PhabricatorRepositoryIdentity::save() called at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:1354]
  #5 <#2> PhabricatorApplicationTransactionEditor::applyTransactions(PhabricatorRepositoryIdentity, array) called at [<phorge>/src/applications/transactions/editengine/PhabricatorEditEngine.php:1149]
  #6 <#2> PhabricatorEditEngine::buildEditResponse(PhabricatorRepositoryIdentity) called at [<phorge>/src/applications/transactions/editengine/PhabricatorEditEngine.php:1000]
  #7 <#2> PhabricatorEditEngine::buildResponse() called at [<phorge>/src/applications/diffusion/controller/DiffusionIdentityEditController.php:9]
  #8 <#2> DiffusionIdentityEditController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #9 phlog(RuntimeException) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
  #10 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #11 AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #12 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:203]
  #13 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]

Fix that exception; get next exception:

[2023-06-02 17:30:40] EXCEPTION: (RuntimeException) mb_detect_encoding(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=b325304b6e52), phorge(head=diffusionCreateIdentity, ref.master=cbc0e661544a, ref.diffusionCreateIdentity=cbc0e661544a)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> mb_detect_encoding(NULL, array) called at [<phorge>/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php:313]
  #2 <#2> PhabricatorLiskDAO::getUTF8StringFromStorage(NULL, NULL) called at [<phorge>/src/applications/repository/storage/PhabricatorRepositoryIdentity.php:57]
  #3 <#2> PhabricatorRepositoryIdentity::getIdentityName() called at [<phorge>/src/applications/repository/storage/PhabricatorRepositoryIdentity.php:63]
  #4 <#2> PhabricatorRepositoryIdentity::getIdentityEmailAddress() called at [<phorge>/src/applications/repository/storage/PhabricatorRepositoryIdentity.php:111]
  #5 <#2> PhabricatorRepositoryIdentity::save() called at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:1354]
  #6 <#2> PhabricatorApplicationTransactionEditor::applyTransactions(PhabricatorRepositoryIdentity, array) called at [<phorge>/src/applications/transactions/editengine/PhabricatorEditEngine.php:1149]
  #7 <#2> PhabricatorEditEngine::buildEditResponse(PhabricatorRepositoryIdentity) called at [<phorge>/src/applications/transactions/editengine/PhabricatorEditEngine.php:1000]
  #8 <#2> PhabricatorEditEngine::buildResponse() called at [<phorge>/src/applications/diffusion/controller/DiffusionIdentityEditController.php:9]
  #9 <#2> DiffusionIdentityEditController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #10 phlog(RuntimeException) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
  #11 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #12 AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #13 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:203]
  #14 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]
[2023-06-02 17:30:40] EXCEPTION: (PhutilAggregateException) Encountered a processing exception, then another exception when trying to build a response for the first exception.
    - RuntimeException: file_exists(): Passing null to parameter #1 ($filename) of type string is deprecated
    - RuntimeException: mb_detect_encoding(): Passing null to parameter #1 ($string) of type string is deprecated at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:316]
arcanist(head=master, ref.master=b325304b6e52), phorge(head=diffusionCreateIdentity, ref.master=cbc0e661544a, ref.diffusionCreateIdentity=cbc0e661544a)
  #0 <#4> mb_detect_encoding(NULL, array) called at [<phorge>/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php:313]
  #1 <#4> PhabricatorLiskDAO::getUTF8StringFromStorage(NULL, NULL) called at [<phorge>/src/applications/repository/storage/PhabricatorRepositoryIdentity.php:57]
  #2 <#4> PhabricatorRepositoryIdentity::getIdentityName() called at [<phorge>/src/applications/repository/storage/PhabricatorRepositoryIdentity.php:63]
  #3 <#4> PhabricatorRepositoryIdentity::getIdentityEmailAddress() called at [<phorge>/src/applications/repository/storage/PhabricatorRepositoryIdentity.php:111]
  #4 <#4> PhabricatorRepositoryIdentity::save() called at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:1354]
  #5 <#4> PhabricatorApplicationTransactionEditor::applyTransactions(PhabricatorRepositoryIdentity, array) called at [<phorge>/src/applications/transactions/editengine/PhabricatorEditEngine.php:1149]
  #6 <#4> PhabricatorEditEngine::buildEditResponse(PhabricatorRepositoryIdentity) called at [<phorge>/src/applications/transactions/editengine/PhabricatorEditEngine.php:1000]
  #7 <#4> PhabricatorEditEngine::buildResponse() called at [<phorge>/src/applications/diffusion/controller/DiffusionIdentityEditController.php:9]
  #8 <#4> DiffusionIdentityEditController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #9 <#3> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #10 <#3> file_exists(NULL) called at [<arcanist>/src/filesystem/Filesystem.php:1068]
  #11 <#3> Filesystem::pathExists(NULL) called at [<arcanist>/src/filesystem/Filesystem.php:1169]
  #12 <#3> Filesystem::assertExists(NULL) called at [<arcanist>/src/filesystem/Filesystem.php:1020]
  #13 <#3> Filesystem::isDescendant(NULL, string) called at [<phorge>/src/view/widget/AphrontStackTraceView.php:33]
  #14 <#3> AphrontStackTraceView::render() called at [<phorge>/src/view/AphrontView.php:222]
  #15 <#3> AphrontView::producePhutilSafeHTML() called at [<phorge>/src/infrastructure/markup/render.php:115]
  #16 <#3> phutil_escape_html(AphrontStackTraceView) called at [<phorge>/src/infrastructure/markup/render.php:139]
  #17 <#3> phutil_escape_html(array) called at [<phorge>/src/infrastructure/markup/render.php:97]
  #18 <#3> phutil_tag(string, array, array) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:62]
  #19 <#3> PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #20 <#3> AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #21 <#2> AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:203]
  #22 <#2> AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]
  #23 phlog(PhutilAggregateException) called at [<phorge>/src/aphront/response/AphrontUnhandledExceptionResponse.php:32]
  #24 AphrontUnhandledExceptionResponse::setException(PhutilAggregateException) called at [<phorge>/webroot/index.php:46]

Fix that exception; get an AphrontQueryException not to be handled in this task but in T15439

Event Timeline

I mentioned in the diff but the "Create Identity" page appears to be incomplete and the issues here and while it uncovers some additional PHP-8 issues after addressing them the functionality of this form would still be incorrect.

@speck: Could you file a separate task please, as this task is only about making existing code not throw an exception under PHP8, while you seem to target workflows not functioning as expected? Thanks! :)