Page MenuHomePhorge

PHP 8.1 "preg_match()" exception when pasting malformed Raw Diff into "Create Diff"
Closed, ResolvedPublic

Description

Steps to reproduce:

  1. PHP 8.1.8; Phorge at 953726d71bfa28f7ab570e9b1bdc8bd53d0bffa0
  2. Go to http://phorge.localhost/differential/
  3. Select the Create a Diff button to go to http://phorge.localhost/differential/diff/create/
  4. In the Raw Diff field, enter the single line whatever
  5. Select the Create Diff button

Actual outcome:

[2023-05-03 18:11:30] EXCEPTION: (RuntimeException) preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=workbColAutoCompl, ref.master=82d1abd4edd1, ref.workbColAutoCompl=057c306f4cb6), phorge(head=createDiff, ref.master=953726d71bfa, ref.createDiff=953726d71bfa)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> preg_match(string, NULL, array) called at [<arcanist>/src/parser/ArcanistDiffParser.php:373]
  #2 <#2> ArcanistDiffParser::tryMatchHeader(array, NULL, array) called at [<arcanist>/src/parser/ArcanistDiffParser.php:266]
  #3 <#2> ArcanistDiffParser::parseDiff(string) called at [<phorge>/src/applications/differential/conduit/DifferentialCreateRawDiffConduitAPIMethod.php:43]
  #4 <#2> DifferentialCreateRawDiffConduitAPIMethod::execute(ConduitAPIRequest) called at [<phorge>/src/applications/conduit/method/ConduitAPIMethod.php:156]
  #5 <#2> ConduitAPIMethod::executeMethod(ConduitAPIRequest) called at [<phorge>/src/applications/conduit/call/ConduitCall.php:131]
  #6 <#2> ConduitCall::executeMethod() called at [<phorge>/src/applications/conduit/call/ConduitCall.php:81]
  #7 <#2> ConduitCall::execute() called at [<phorge>/src/applications/differential/controller/DifferentialDiffCreateController.php:73]
  #8 <#2> DifferentialDiffCreateController::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:204]
  #13 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]

[2023-05-03 18:11:30] 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: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:316]
arcanist(head=workbColAutoCompl, ref.master=82d1abd4edd1, ref.workbColAutoCompl=057c306f4cb6), phorge(head=createDiff, ref.master=953726d71bfa, ref.createDiff=953726d71bfa)
  #0 <#4> preg_match(string, NULL, array) called at [<arcanist>/src/parser/ArcanistDiffParser.php:373]
  #1 <#4> ArcanistDiffParser::tryMatchHeader(array, NULL, array) called at [<arcanist>/src/parser/ArcanistDiffParser.php:266]
  #2 <#4> ArcanistDiffParser::parseDiff(string) called at [<phorge>/src/applications/differential/conduit/DifferentialCreateRawDiffConduitAPIMethod.php:43]
  #3 <#4> DifferentialCreateRawDiffConduitAPIMethod::execute(ConduitAPIRequest) called at [<phorge>/src/applications/conduit/method/ConduitAPIMethod.php:156]
  #4 <#4> ConduitAPIMethod::executeMethod(ConduitAPIRequest) called at [<phorge>/src/applications/conduit/call/ConduitCall.php:131]
  #5 <#4> ConduitCall::executeMethod() called at [<phorge>/src/applications/conduit/call/ConduitCall.php:81]
  #6 <#4> ConduitCall::execute() called at [<phorge>/src/applications/differential/controller/DifferentialDiffCreateController.php:73]
  #7 <#4> DifferentialDiffCreateController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #8 <#3> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #9 <#3> file_exists(NULL) called at [<arcanist>/src/filesystem/Filesystem.php:1068]
  #10 <#3> Filesystem::pathExists(NULL) called at [<arcanist>/src/filesystem/Filesystem.php:1169]
  #11 <#3> Filesystem::assertExists(NULL) called at [<arcanist>/src/filesystem/Filesystem.php:1020]
  #12 <#3> Filesystem::isDescendant(NULL, string) called at [<phorge>/src/view/widget/AphrontStackTraceView.php:33]
  #13 <#3> AphrontStackTraceView::render() called at [<phorge>/src/view/AphrontView.php:222]
  #14 <#3> AphrontView::producePhutilSafeHTML() called at [<phorge>/src/infrastructure/markup/render.php:115]
  #15 <#3> phutil_escape_html(AphrontStackTraceView) called at [<phorge>/src/infrastructure/markup/render.php:139]
  #16 <#3> phutil_escape_html(array) called at [<phorge>/src/infrastructure/markup/render.php:97]
  #17 <#3> phutil_tag(string, array, array) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:67]
  #18 <#3> PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #19 <#3> AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #20 <#2> AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
  #21 <#2> AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]
  #22 phlog(PhutilAggregateException) called at [<phorge>/src/aphront/response/AphrontUnhandledExceptionResponse.php:32]
  #23 AphrontUnhandledExceptionResponse::setException(PhutilAggregateException) called at [<phorge>/webroot/index.php:46]

Expected outcome:

A Diff Parse Exception:

diffdiffdiff.png (897×961 px, 94 KB)

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.