Page MenuHomePhabricator

PHP Warning: json_decode() expects parameter 1 to be string, array given
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.36.0-wmf.21

message
PHP Warning: json_decode() expects parameter 1 to be string, array given

Impact

Notes

Details

Request ID
X9pXJApAMNsAA9TFXSQAAABB
Request URL
https://meta.wikimedia.org/w/rest.php/oauth2/client?limit=5&oauth_version=2&sort=%7B%22property%22%3A%22registration%22%2C%22direction%22%3A%22DESC%22%7D
Stack Trace
exception.trace
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.36.0-wmf.21/includes/json/FormatJson.php(175): json_decode(array, integer)
#2 /srv/mediawiki/php-1.36.0-wmf.21/extensions/OAuth/src/Rest/Handler/ListClients.php(201): FormatJson::decode(array, integer)
#3 /srv/mediawiki/php-1.36.0-wmf.21/extensions/OAuth/src/Rest/Handler/ListClients.php(159): MediaWiki\Extensions\OAuth\Rest\Handler\ListClients->processDbResults(Wikimedia\Rdbms\ResultWrapper)
#4 /srv/mediawiki/php-1.36.0-wmf.21/extensions/OAuth/src/Rest/Handler/ListClients.php(88): MediaWiki\Extensions\OAuth\Rest\Handler\ListClients->getDbResults(integer)
#5 /srv/mediawiki/php-1.36.0-wmf.21/includes/Rest/SimpleHandler.php(38): MediaWiki\Extensions\OAuth\Rest\Handler\ListClients->run()
#6 /srv/mediawiki/php-1.36.0-wmf.21/includes/Rest/Router.php(389): MediaWiki\Rest\SimpleHandler->execute()
#7 /srv/mediawiki/php-1.36.0-wmf.21/includes/Rest/Router.php(316): MediaWiki\Rest\Router->executeHandler(MediaWiki\Extensions\OAuth\Rest\Handler\ListClients)
#8 /srv/mediawiki/php-1.36.0-wmf.21/includes/Rest/EntryPoint.php(152): MediaWiki\Rest\Router->execute(MediaWiki\Rest\RequestFromGlobals)
#9 /srv/mediawiki/php-1.36.0-wmf.21/includes/Rest/EntryPoint.php(117): MediaWiki\Rest\EntryPoint->execute()
#10 /srv/mediawiki/php-1.36.0-wmf.21/rest.php(31): MediaWiki\Rest\EntryPoint::main()
#11 /srv/mediawiki/w/rest.php(3): require(string)
#12 {main}

Event Timeline

Probably this might be a simple error where the values are supposed to be 'encoded' to json, but 'decode' was called. The input 'oauth2GrantTypes' is clearly an array, and the output is suppose to be in json.

With decoding
{"clients":[{"name":"Hello World"..."allowed_grants":null,"scopes":["basic","editprotected","editmycssjs","createeditmovepage","patrol"]}],"total":1}

Without decoding
{"clients":[{"name":"Hello World"..."allowed_grants":["importupload","apihighlimits"],"scopes":["basic","editprotected","editmycssjs","createeditmovepage","patrol"]}],"total":1}

Change 651690 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/extensions/OAuth@master] Don't json decode oauth2GrantTypes in Rest clients listing

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

Change 651690 merged by jenkins-bot:
[mediawiki/extensions/OAuth@master] Don't json decode oauth2GrantTypes in Rest clients listing

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

Clarakosi assigned this task to Ammarpad.
Clarakosi moved this task from Later to Done on the Platform Team Workboards (Clinic Duty Team) board.
Clarakosi added a subscriber: Clarakosi.

Thanks, @Ammarpad!