Page MenuHomePhorge

Fix Diviner generation in PHP 8
Closed, ResolvedPublic

Description

When using ./bin/diviner generate multiple things can happen in PHP 8:

1: strlen(null) in DivinerGenerateWorkflow.php:197

[2023-04-14 14:42:01] 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=08dfffd5caf7), phorge(head=master, ref.master=1b9da964e970)
  #0 PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diviner/workflow/DivinerGenerateWorkflow.php:197]
  #1 DivinerGenerateWorkflow::generateBook(string, PhutilArgumentParser) called at [<phorge>/src/applications/diviner/workflow/DivinerGenerateWorkflow.php:80]
  #2 DivinerGenerateWorkflow::execute(PhutilArgumentParser) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:492]
  #3 PhutilArgumentParser::parseWorkflowsFull(array) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:377]
  #4 PhutilArgumentParser::parseWorkflows(array) called at [<phorge>/scripts/diviner/diviner.php:21]

2. strlen(null) in DivinerBookQuery.php:136

[2023-04-14 14:44:53] 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=08dfffd5caf7), phorge(head=master, ref.master=1b9da964e970)
  #0 PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diviner/query/DivinerBookQuery.php:136]
  #1 DivinerBookQuery::buildWhereClause(AphrontMySQLiDatabaseConnection) called at [<phorge>/src/applications/diviner/query/DivinerBookQuery.php:63]
  #2 DivinerBookQuery::loadPage() called at [<phorge>/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php:251]
  #3 PhabricatorPolicyAwareQuery::execute() called at [<phorge>/src/applications/diviner/query/DivinerAtomQuery.php:147]
  #4 DivinerAtomQuery::willFilterPage(array) called at [<phorge>/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php:262]
  #5 PhabricatorPolicyAwareQuery::execute() called at [<phorge>/src/applications/diviner/publisher/DivinerLivePublisher.php:89]
  #6 DivinerLivePublisher::loadAllPublishedHashes() called at [<phorge>/src/applications/diviner/publisher/DivinerPublisher.php:121]
  #7 DivinerPublisher::publishAtoms(array) called at [<phorge>/src/applications/diviner/workflow/DivinerGenerateWorkflow.php:583]
  #8 DivinerGenerateWorkflow::publishDocumentation(boolean, DivinerLivePublisher) called at [<phorge>/src/applications/diviner/workflow/DivinerGenerateWorkflow.php:213]
  #9 DivinerGenerateWorkflow::generateBook(string, PhutilArgumentParser) called at [<phorge>/src/applications/diviner/workflow/DivinerGenerateWorkflow.php:80]
  #10 DivinerGenerateWorkflow::execute(PhutilArgumentParser) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:492]
  #11 PhutilArgumentParser::parseWorkflowsFull(array) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:377]
  #12 PhutilArgumentParser::parseWorkflows(array) called at [<phorge>/scripts/diviner/diviner.php:21]

3. strlen(null) in DivinerLiveSymbol.php:185

[2023-04-14 14:46:34] 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=08dfffd5caf7), phorge(head=master, ref.master=1b9da964e970)
  #0 PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diviner/storage/DivinerLiveSymbol.php:185]
  #1 DivinerLiveSymbol::setTitle(NULL) called at [<phorge>/src/applications/diviner/publisher/DivinerLivePublisher.php:135]
  #2 DivinerLivePublisher::createDocumentsByHash(array) called at [<phorge>/src/applications/diviner/publisher/DivinerPublisher.php:151]
  #3 DivinerPublisher::publishAtoms(array) called at [<phorge>/src/applications/diviner/workflow/DivinerGenerateWorkflow.php:583]
  #4 DivinerGenerateWorkflow::publishDocumentation(boolean, DivinerLivePublisher) called at [<phorge>/src/applications/diviner/workflow/DivinerGenerateWorkflow.php:213]
  #5 DivinerGenerateWorkflow::generateBook(string, PhutilArgumentParser) called at [<phorge>/src/applications/diviner/workflow/DivinerGenerateWorkflow.php:80]
  #6 DivinerGenerateWorkflow::execute(PhutilArgumentParser) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:492]
  #7 PhutilArgumentParser::parseWorkflowsFull(array) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:377]
  #8 PhutilArgumentParser::parseWorkflows(array) called at [<phorge>/scripts/diviner/diviner.php:21]

Most of them are related to:

T15190: PHP 8.1: strlen() and other scalar-only functions do not accept NULL anymore - understand fix strategies

Event Timeline

valerio.bozzolan created this task.
valerio.bozzolan created this object in space S1 Public.