Page MenuHomePhabricator

PHP Warning: htmlspecialchars() expects string (from WikiPage.php)
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.35.0-wmf.19

message
PHP Warning: htmlspecialchars() expects parameter 1 to be string, object given
exception.trace
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.35.0-wmf.19/includes/page/WikiPage.php(3186): htmlspecialchars(MediaWiki\User\UserIdentityValue)
#2 /srv/mediawiki/php-1.35.0-wmf.19/includes/page/WikiPage.php(3132): WikiPage->commitRollback(MediaWiki\User\UserIdentityValue, string, boolean, array, User, NULL)
#3 /srv/mediawiki/php-1.35.0-wmf.19/includes/api/ApiRollback.php(76): WikiPage->doRollback(MediaWiki\User\UserIdentityValue, string, string, boolean, array, User, NULL)
#4 /srv/mediawiki/php-1.35.0-wmf.19/includes/api/ApiMain.php(1586): ApiRollback->execute()
#5 /srv/mediawiki/php-1.35.0-wmf.19/includes/api/ApiMain.php(522): ApiMain->executeAction()
#6 /srv/mediawiki/php-1.35.0-wmf.19/includes/api/ApiMain.php(493): ApiMain->executeActionWithErrorHandling()
#7 /srv/mediawiki/php-1.35.0-wmf.19/api.php(84): ApiMain->execute()
#8 /srv/mediawiki/w/api.php(3): require(string)
#9 {main}

Impact

Notes

Started on 2012-02-12 (yesterday).

Details

Request ID
XkViWQpAIDgAAAYLbYUAAAAY
Request URL
https://meta.wikimedia.org/w/api.php

Related Objects

StatusSubtypeAssignedTask
ResolvedReleasedduvall
ResolvedPRODUCTION ERRORDaimona

Event Timeline

Krinkle created this task.Feb 13 2020, 3:08 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 13 2020, 3:08 PM
RhinosF1 triaged this task as Unbreak Now! priority.Feb 13 2020, 3:12 PM
RhinosF1 added a subscriber: RhinosF1.

Train Blocker == UBN!

Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptFeb 13 2020, 3:12 PM

The below looks like a variation of the same error so reporting here instead of a new task:

[{exception_id}] {exception_url}   ErrorException from line 3178 of /srv/mediawiki/php-1.35.0-wmf.19/includes/page/WikiPage.php: PHP Unknown error: Object of class MediaWiki\User\UserIdentityValue could not be converted to string

#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.35.0-wmf.19/includes/page/WikiPage.php(3178): str_replace(string, string, MediaWiki\User\UserIdentityValue)
#2 /srv/mediawiki/php-1.35.0-wmf.19/includes/page/WikiPage.php(3132): WikiPage->commitRollback(MediaWiki\User\UserIdentityValue, string, boolean, NULL, User, NULL)
#3 /srv/mediawiki/php-1.35.0-wmf.19/includes/api/ApiRollback.php(76): WikiPage->doRollback(MediaWiki\User\UserIdentityValue, string, string, boolean, NULL, User, NULL)
#4 /srv/mediawiki/php-1.35.0-wmf.19/includes/api/ApiMain.php(1586): ApiRollback->execute()
#5 /srv/mediawiki/php-1.35.0-wmf.19/includes/api/ApiMain.php(522): ApiMain->executeAction()
#6 /srv/mediawiki/php-1.35.0-wmf.19/includes/api/ApiMain.php(493): ApiMain->executeActionWithErrorHandling()
#7 /srv/mediawiki/php-1.35.0-wmf.19/api.php(84): ApiMain->execute()
#8 /srv/mediawiki/w/api.php(3): require(string)
#9 {main}

Not surprising:

	/**
	 * @param string $fromP Name of the user whose edits to rollback.
	 */
	public function commitRollback( $fromP, $summary, $bot,
		&$resultDetails, User $guser, $tags = null
	) {

but

#2 /srv/mediawiki/php-1.35.0-wmf.19/includes/page/WikiPage.php(3132): WikiPage->commitRollback(MediaWiki\User\UserIdentityValue, string, boolean, array, User, NULL)

the caller is screwing up with types.

In ApiRollback:

$retval = $pageObj->doRollback( $this->getRbUser( $params ), ...

and

	 * @return string
	 */
	private function getRbUser( array $params ) {

Caused by https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/434718/. This should be an easy fix, but IMHO it would be a good idea to add a few typehints, so that this error is caught sooner.

Change 572022 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/core@master] ApiRollback: Properly deal with UserIdentity

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

Daimona claimed this task.Feb 13 2020, 5:37 PM

Change 572071 had a related patch set uploaded (by Jforrester; owner: Daimona Eaytoy):
[mediawiki/core@wmf/1.35.0-wmf.19] ApiRollback: Properly deal with UserIdentity

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

Change 572022 merged by jenkins-bot:
[mediawiki/core@master] ApiRollback: Properly deal with UserIdentity

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

Change 572071 merged by jenkins-bot:
[mediawiki/core@wmf/1.35.0-wmf.19] ApiRollback: Properly deal with UserIdentity

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

Mentioned in SAL (#wikimedia-operations) [2020-02-13T19:44:52Z] <jforrester@deploy1001> Synchronized php-1.35.0-wmf.19/includes/api/ApiRollback.php: T245159 ApiRollback: Properly deal with UserIdentity (duration: 01m 04s)

Jdforrester-WMF closed this task as Resolved.Feb 13 2020, 7:56 PM
Jdforrester-WMF added a subscriber: Jdforrester-WMF.

Deployed. Thank you.