"Trying to access array offset on value of type null" exception when viewing diffs

After an upgrade to the latest version of Phabricator, some users are running into an exception message when viewing specific diffs:

Unhandled Exception ("RuntimeException")	
Trying to access array offset on value of type null

When dismissing the message itself the user noticed that one of the files in the changeset seemed to be missing changes that they’d diffed.

From the logfiles:

2020/05/25 17:04:34 [error] 24732#24732: *12120 FastCGI sent in stderr: 
"PHP message: [2020-05-25 13:04:34] EXCEPTION: (RuntimeException) 
Trying to access array offset on value of type null at [<arcanist>/src/error/PhutilErrorHandler.php:263]
PHP message: arcanist(head=master, ref.master=e3030ebcad53), 
phabricator(head=master, ref.master=2262bfcd1cbb)
PHP message:   #0 <#2> PhutilErrorHandler::handleError called at 
[<phabricator>/src/applications/differential/parser/DifferentialChangesetParser.php:1330]
PHP message:   #1 <#2> DifferentialChangesetParser::renderModifiedCoverage called at 
[<phabricator>/src/applications/differential/controller/DifferentialChangesetViewController.php:268]
PHP message:   #2 <#2> DifferentialChangesetViewController::handleRequest called at 
[<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:288]
PHP message:   #3 phlog called at 
[<phabricator>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
PHP message:   #4 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable 
called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:752]
PHP message:   #5 AphrontApplicationConfiguration::handleThrowable called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:300]
PHP message:   #6 AphrontApplicationConfiguration::processRequest called at 
[<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:208]
PHP message:   #7 AphrontApplicationConfiguration::runHTTPRequest called at 
[<phabricator>/webroot/index.php:35]" while reading response header from upstream, 
client: <ip address>, server: phabricator.<domain>.com, 
request: "POST /differential/changeset/ HTTP/1.1", 
upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "phabricator.<domain>.com"

Seems like the actual issue is along the lines of this similar error: Exceptions when viewing diffs

Downgrading to PHP 7.2 resolves the error completely. The user noticed that once the downgrade was in place the file that seemed to be missing changes was now visibly correct without having to run arc diff again, which was also fantastic.

Reproduction Instructions

  • Run Phabricator on PHP 7.4
  • Visit an affected diff

What constitutes an “affected” diff is still a bit of a mystery to me, though. Out of the better part of a hundred in-flight diffs we only had one report of this.

Phabricator/Arcanist Version

  • phabricator - 2262bfcd1cbb a fresh pull of the a529efa5b855
  • arcanist - e3030ebcad53

This does not appear to be an upstream version.

$ git show 2262bfcd1cbb
fatal: ambiguous argument '2262bfcd1cbb': unknown revision or path not in the working tree.

To help you with this, I need reproduction instructions that work against an unmodified, up-to-date version of Phabricator.

1 Like

Ah, sorry about that! We’d made changes a couple years back to use a bot for managing detailed priorities but abandoned that a year ago, but had kept the old code on a branch in our local repo for posterity.

Can repro against a fresh copy of a529efa Fix an issue where inline comments with only edit suggestions are considered empty as well, with PHP 7.4. Still goes away with PHP 7.2.

1 Like