Page MenuHomePhabricator

Error: Trying to access array offset on value of type null (includes/deferred/DeferredUpdates.php:237) on PHP 7.4
Closed, ResolvedPublicBUG REPORT

Description

PHP 7.4 tests are failing on multiple repositories due to a common error (eg https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/PageTriage/+/584668/ only has a commit message, but the test still failed)

11:05:14 Dumping file(s) mw-error.log
11:05:14 + set +e
11:05:14 + cd /srv/jenkins/workspace/workspace/quibble-vendor-mysql-php74-docker/log
11:05:14 + grep --color . mw-error.log
11:05:14 2020-03-30 18:03:32 cf60bdc56f7f wikidb: [665416b8da28a05f62ce7a94] /index.php?title=BeforeEach-name-0.9997845813782571-I%C3%B1t%C3%ABrn%C3%A2ti%C3%B4n%C3%A0liz%C3%A6ti%C3%B8n&action=submit   ErrorException from line 237 of /workspace/src/includes/deferred/DeferredUpdates.php: PHP Notice: Trying to access array offset on value of type null
11:05:14 #0 /workspace/src/includes/deferred/DeferredUpdates.php(237): MWExceptionHandler::handleError()
11:05:14 #1 /workspace/src/includes/deferred/DeferredUpdates.php(150): DeferredUpdates::handleUpdateQueue()
11:05:14 #2 /workspace/src/includes/MediaWiki.php(1059): DeferredUpdates::doUpdates()
11:05:14 #3 /workspace/src/includes/MediaWiki.php(839): MediaWiki->restInPeace()
11:05:14 #4 /workspace/src/includes/MediaWiki.php(859): MediaWiki->{closure}()
11:05:14 #5 /workspace/src/includes/MediaWiki.php(574): MediaWiki->doPostOutputShutdown()
11:05:14 #6 /workspace/src/index.php(47): MediaWiki->run()
11:05:14 #7 {main}
11:05:14 2020-03-30 18:03:33 cf60bdc56f7f wikidb: [10a3e56aa570ec5ebfceeb8f] /index.php?title=BeforeEach-name-0.02593870942175247-I%C3%B1t%C3%ABrn%C3%A2ti%C3%B4n%C3%A0liz%C3%A6ti%C3%B8n&action=submit   ErrorException from line 237 of /workspace/src/includes/deferred/DeferredUpdates.php: PHP Notice: Trying to access array offset on value of type null
11:05:14 #0 /workspace/src/includes/deferred/DeferredUpdates.php(237): MWExceptionHandler::handleError()
11:05:14 #1 /workspace/src/includes/deferred/DeferredUpdates.php(150): DeferredUpdates::handleUpdateQueue()
11:05:14 #2 /workspace/src/includes/MediaWiki.php(1059): DeferredUpdates::doUpdates()
11:05:14 #3 /workspace/src/includes/MediaWiki.php(839): MediaWiki->restInPeace()
11:05:14 #4 /workspace/src/includes/MediaWiki.php(859): MediaWiki->{closure}()
11:05:14 #5 /workspace/src/includes/MediaWiki.php(574): MediaWiki->doPostOutputShutdown()
11:05:14 #6 /workspace/src/index.php(47): MediaWiki->run()
11:05:14 #7 {main}
11:05:14 2020-03-30 18:03:35 cf60bdc56f7f wikidb: [9c3c49439dec9d888816c59f] /index.php?title=BeforeEach-name-0.35932370040107586-I%C3%B1t%C3%ABrn%C3%A2ti%C3%B4n%C3%A0liz%C3%A6ti%C3%B8n&action=submit   ErrorException from line 237 of /workspace/src/includes/deferred/DeferredUpdates.php: PHP Notice: Trying to access array offset on value of type null
11:05:14 #0 /workspace/src/includes/deferred/DeferredUpdates.php(237): MWExceptionHandler::handleError()
11:05:14 #1 /workspace/src/includes/deferred/DeferredUpdates.php(150): DeferredUpdates::handleUpdateQueue()
11:05:14 #2 /workspace/src/includes/MediaWiki.php(1059): DeferredUpdates::doUpdates()
11:05:14 #3 /workspace/src/includes/MediaWiki.php(839): MediaWiki->restInPeace()
11:05:14 #4 /workspace/src/includes/MediaWiki.php(859): MediaWiki->{closure}()
11:05:14 #5 /workspace/src/includes/MediaWiki.php(574): MediaWiki->doPostOutputShutdown()
11:05:14 #6 /workspace/src/index.php(47): MediaWiki->run()
11:05:14 #7 {main}
11:05:14 2020-03-30 18:03:38 cf60bdc56f7f wikidb: [b70a7998f6fae9c2094580ec] /index.php?title=BeforeEach-name-0.5304086324145123-I%C3%B1t%C3%ABrn%C3%A2ti%C3%B4n%C3%A0liz%C3%A6ti%C3%B8n&action=delete   ErrorException from line 237 of /workspace/src/includes/deferred/DeferredUpdates.php: PHP Notice: Trying to access array offset on value of type null
11:05:14 #0 /workspace/src/includes/deferred/DeferredUpdates.php(237): MWExceptionHandler::handleError()
11:05:14 #1 /workspace/src/includes/deferred/DeferredUpdates.php(150): DeferredUpdates::handleUpdateQueue()
11:05:14 #2 /workspace/src/includes/MediaWiki.php(1059): DeferredUpdates::doUpdates()
11:05:14 #3 /workspace/src/includes/MediaWiki.php(839): MediaWiki->restInPeace()
11:05:14 #4 /workspace/src/includes/MediaWiki.php(859): MediaWiki->{closure}()
11:05:14 #5 /workspace/src/includes/MediaWiki.php(574): MediaWiki->doPostOutputShutdown()
11:05:14 #6 /workspace/src/index.php(47): MediaWiki->run()
11:05:14 #7 {main}
11:05:14 2020-03-30 18:03:40 cf60bdc56f7f wikidb: [ea2e27cf7de5144f23bf5d19] /index.php?title=Special:Undelete&action=submit   ErrorException from line 237 of /workspace/src/includes/deferred/DeferredUpdates.php: PHP Notice: Trying to access array offset on value of type null
11:05:14 #0 /workspace/src/includes/deferred/DeferredUpdates.php(237): MWExceptionHandler::handleError()
11:05:14 #1 /workspace/src/includes/deferred/DeferredUpdates.php(150): DeferredUpdates::handleUpdateQueue()
11:05:14 #2 /workspace/src/includes/MediaWiki.php(1059): DeferredUpdates::doUpdates()
11:05:14 #3 /workspace/src/includes/MediaWiki.php(839): MediaWiki->restInPeace()
11:05:14 #4 /workspace/src/includes/MediaWiki.php(859): MediaWiki->{closure}()
11:05:14 #5 /workspace/src/includes/MediaWiki.php(574): MediaWiki->doPostOutputShutdown()
11:05:14 #6 /workspace/src/index.php(47): MediaWiki->run()
11:05:14 #7 {main}
11:05:14 2020-03-30 18:03:41 cf60bdc56f7f wikidb: [acc714eb27b0a78edfdd46b1] /index.php?title=BeforeEach-name-0.7802289035705332-I%C3%B1t%C3%ABrn%C3%A2ti%C3%B4n%C3%A0liz%C3%A6ti%C3%B8n&action=submit   ErrorException from line 237 of /workspace/src/includes/deferred/DeferredUpdates.php: PHP Notice: Trying to access array offset on value of type null
11:05:14 #0 /workspace/src/includes/deferred/DeferredUpdates.php(237): MWExceptionHandler::handleError()
11:05:14 #1 /workspace/src/includes/deferred/DeferredUpdates.php(150): DeferredUpdates::handleUpdateQueue()
11:05:14 #2 /workspace/src/includes/MediaWiki.php(1059): DeferredUpdates::doUpdates()
11:05:14 #3 /workspace/src/includes/MediaWiki.php(839): MediaWiki->restInPeace()
11:05:14 #4 /workspace/src/includes/MediaWiki.php(859): MediaWiki->{closure}()
11:05:14 #5 /workspace/src/includes/MediaWiki.php(574): MediaWiki->doPostOutputShutdown()
11:05:14 #6 /workspace/src/index.php(47): MediaWiki->run()
11:05:14 #7 {main}
11:05:14 2020-03-30 18:04:00 cf60bdc56f7f wikidb: [b1b5ac8c63cdcdff7dde5348] /index.php/Special:CreateAccount   ErrorException from line 237 of /workspace/src/includes/deferred/DeferredUpdates.php: PHP Notice: Trying to access array offset on value of type null
11:05:14 #0 /workspace/src/includes/deferred/DeferredUpdates.php(237): MWExceptionHandler::handleError()
11:05:14 #1 /workspace/src/includes/deferred/DeferredUpdates.php(150): DeferredUpdates::handleUpdateQueue()
11:05:14 #2 /workspace/src/includes/MediaWiki.php(1059): DeferredUpdates::doUpdates()
11:05:14 #3 /workspace/src/includes/MediaWiki.php(839): MediaWiki->restInPeace()
11:05:14 #4 /workspace/src/includes/MediaWiki.php(859): MediaWiki->{closure}()
11:05:14 #5 /workspace/src/includes/MediaWiki.php(574): MediaWiki->doPostOutputShutdown()
11:05:14 #6 /workspace/src/index.php(47): MediaWiki->run()
11:05:14 #7 {main}

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Krinkle renamed this task from PHP 7.4 failure: ErrorException from line 237 of /workspace/src/includes/deferred/DeferredUpdates.php to Error: Trying to access array offset on value of type null (includes/deferred/DeferredUpdates.php:237) on PHP 7.4.Mar 30 2020, 6:12 PM

Looks like fall-out from T246358, but I'd have expected it to fail in all PHP flavours, not just 74?

DannyS712 changed the subtype of this task from "Task" to "Bug Report".Mar 30 2020, 6:14 PM
	self::$executeContext = [ 'stage' => $stage, 'subqueue' => [] ];
	try {
		$e = self::run( $du, $lbf, $logger, $stats, $httpMethod );
		// …
		while ( self::$executeContext['subqueue'] ) { # <! Error: array offset on null 
			// …
			unset( self::$executeContext['subqueue'][$firstKey] );
			// …
		}
	} finally {
		// …
		self::$executeContext = null;
	}

Interesting. It would seem that an exception (presumably from run()) is aborting the while-loop and reaching the finally block (that part makes sense) but then somehow getting back into the while-loop?

Looks like fall-out from T246358, but I'd have expected it to fail in all PHP flavours, not just 74?

The behaviour itself is unchanged from previous PHP versions. Access on null yields null. But as of PHP 7.4 that triggers a runtime warning as it's likely unintentional. I's not thrown a exception or fatal, that's only something we do in our log file for backtrace convenience. We've fixed a number of these in various extensions when adding the php74 jobs. I guess this part just wasn't covered by any tests, so we only find it "naturally" through side effects like those htat mw-error.log helps us catch.

Jdforrester-WMF triaged this task as Unbreak Now! priority.Mar 30 2020, 6:40 PM

Change 584703 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[integration/config@master] jjb: Revert "Add 'assert-no-mediawiki-errors' to mediawiki quibble jobs"

https://gerrit.wikimedia.org/r/584703

Change 584703 merged by jenkins-bot:
[integration/config@master] jjb: Revert "Add 'assert-no-mediawiki-errors' to mediawiki quibble jobs"

https://gerrit.wikimedia.org/r/584703