Page MenuHomePhabricator

PHP Notice: Trying to access array offset on value of type null (via API RevisionDelete)
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   PHP Notice: Trying to access array offset on value of type null
FrameLocationCall
from/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiRevisionDelete.php(122)
#0/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiRevisionDelete.php(122)MWExceptionHandler::handleError(int, string, string, int, array)
#1/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiMain.php(2012)MediaWiki\Api\ApiRevisionDelete->execute()
#2/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiMain.php(947)MediaWiki\Api\ApiMain->executeAction()
#3/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiMain.php(918)MediaWiki\Api\ApiMain->executeActionWithErrorHandling()
#4/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiEntryPoint.php(152)MediaWiki\Api\ApiMain->execute()
#5/srv/mediawiki/php-1.44.0-wmf.18/includes/MediaWikiEntryPoint.php(202)MediaWiki\Api\ApiEntryPoint->execute()
#6/srv/mediawiki/php-1.44.0-wmf.18/api.php(44)MediaWiki\MediaWikiEntryPoint->run()
#7/srv/mediawiki/w/api.php(3)require(string)
#8{main}
Impact
Notes

Event Timeline

Error
normalized_message
[{reqId}] {exception_url}   Error: Unsupported operand types
Impact
Notes
Error
normalized_message
[{reqId}] {exception_url}   PHP Notice: Undefined offset: 20250221082032
FrameLocationCall
from/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiRevisionDelete.php(129)
#0/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiRevisionDelete.php(129)MWExceptionHandler::handleError(int, string, string, int, array)
#1/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiMain.php(2012)MediaWiki\Api\ApiRevisionDelete->execute()
#2/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiMain.php(947)MediaWiki\Api\ApiMain->executeAction()
#3/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiMain.php(918)MediaWiki\Api\ApiMain->executeActionWithErrorHandling()
#4/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiEntryPoint.php(152)MediaWiki\Api\ApiMain->execute()
#5/srv/mediawiki/php-1.44.0-wmf.18/includes/MediaWikiEntryPoint.php(202)MediaWiki\Api\ApiEntryPoint->execute()
#6/srv/mediawiki/php-1.44.0-wmf.18/api.php(44)MediaWiki\MediaWikiEntryPoint->run()
#7/srv/mediawiki/w/api.php(3)require(string)
#8{main}
Impact
Notes
Error
normalized_message
[{reqId}] {exception_url}   PHP Warning: Invalid argument supplied for foreach()
FrameLocationCall
from/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiRevisionDelete.php(122)
#0/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiRevisionDelete.php(122)MWExceptionHandler::handleError(int, string, string, int, array)
#1/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiMain.php(2012)MediaWiki\Api\ApiRevisionDelete->execute()
#2/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiMain.php(947)MediaWiki\Api\ApiMain->executeAction()
#3/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiMain.php(918)MediaWiki\Api\ApiMain->executeActionWithErrorHandling()
#4/srv/mediawiki/php-1.44.0-wmf.18/includes/api/ApiEntryPoint.php(152)MediaWiki\Api\ApiMain->execute()
#5/srv/mediawiki/php-1.44.0-wmf.18/includes/MediaWikiEntryPoint.php(202)MediaWiki\Api\ApiEntryPoint->execute()
#6/srv/mediawiki/php-1.44.0-wmf.18/api.php(44)MediaWiki\MediaWikiEntryPoint->run()
#7/srv/mediawiki/w/api.php(3)require(string)
#8{main}
Impact
Notes
Pppery renamed this task from PHP Notice: Trying to access array offset on value of type null to PHP Notice: Trying to access array offset on value of type null (via API RevisionDelete).Mar 1 2025, 11:42 PM

So if a return early happens...

https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+blame/refs/heads/wmf/1.44.0-wmf.18/includes/revisiondelete/RevDelList.php#151

	151			$status->merge( $this->acquireItemLocks() );
	152			if ( !$status->isGood() ) {
	153				return $status;
	154			}

itemStatuses hasn't been set - https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+blame/refs/heads/wmf/1.44.0-wmf.18/includes/revisiondelete/RevDelList.php#170

Brad Jorsch	9832b28	2013-06-26 16:59:40 -0400	[diff] [blame]	170			if ( $perItemStatus ) {
Umherirrender	e6f4dc9	2023-01-07 21:38:34 +0100	[diff] [blame]	171				$status->value['itemStatuses'] = [];
Brad Jorsch	9832b28	2013-06-26 16:59:40 -0400	[diff] [blame]	172			}

Should the caller expect that it is defined if we pass 'perItemStatus' => true, - https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+blame/refs/heads/wmf/1.44.0-wmf.18/includes/api/ApiRevisionDelete.php#113 that is defined in the (return) value? Or should they be checking that it is set/something similar to the !$status->isGood() that caused the early return? Though in the latter case, something else may happen later to cause the status to not be good anyway...

Change #1123774 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/core@master] RevDelList: Ensure setVisibility always includes itemStatuses in value if applicable

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

Change #1123774 merged by jenkins-bot:

[mediawiki/core@master] RevDelList: Ensure setVisibility always includes itemStatuses in value if applicable

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

Change #1125572 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/core@REL1_43] RevDelList: Ensure setVisibility always includes itemStatuses in value if applicable

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

Change #1125573 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/core@REL1_42] RevDelList: Ensure setVisibility always includes itemStatuses in value if applicable

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

Change #1125574 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/core@REL1_39] RevDelList: Ensure setVisibility always includes itemStatuses in value if applicable

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

Reedy claimed this task.

Change #1125574 merged by jenkins-bot:

[mediawiki/core@REL1_39] RevDelList: Ensure setVisibility always includes itemStatuses in value if applicable

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

Change #1125573 merged by jenkins-bot:

[mediawiki/core@REL1_42] RevDelList: Ensure setVisibility always includes itemStatuses in value if applicable

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

Change #1125572 merged by jenkins-bot:

[mediawiki/core@REL1_43] RevDelList: Ensure setVisibility always includes itemStatuses in value if applicable

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