Page MenuHomePhabricator

PHP Deprecated: $wgUser reassignment detected [Called from PPFrame_Hash::expand]
Closed, ResolvedPublicPRODUCTION ERROR

Assigned To
Authored By
hashar
Dec 15 2022, 9:17 AM
Referenced Files
F35878986: image.png
Dec 19 2022, 11:05 PM
F35878976: image.png
Dec 19 2022, 11:03 PM
F35878975: image.png
Dec 19 2022, 11:03 PM
F35878974: image.png
Dec 19 2022, 11:03 PM
F35878973: image.png
Dec 19 2022, 11:03 PM
F35878971: image.png
Dec 19 2022, 11:03 PM
F35878970: image.png
Dec 19 2022, 11:03 PM
Unknown Object (File)
Dec 19 2022, 11:03 PM

Description

Error
normalized_message
[{reqId}] {exception_url}   PHP Deprecated: $wgUser reassignment detected [Called from PPFrame_Hash::expand]
exception.trace
from /srv/mediawiki/php-1.40.0-wmf.14/includes/parser/PPFrame_Hash.php(275)
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, string, array)
#1 /srv/mediawiki/php-1.40.0-wmf.14/includes/debug/MWDebug.php(381): trigger_error(string, integer)
#2 /srv/mediawiki/php-1.40.0-wmf.14/includes/debug/MWDebug.php(352): MWDebug::sendRawDeprecated(string, boolean, string)
#3 /srv/mediawiki/php-1.40.0-wmf.14/includes/GlobalFunctions.php(795): MWDebug::deprecatedMsg(string, string, string, integer)
#4 /srv/mediawiki/php-1.40.0-wmf.14/includes/StubObject/StubGlobalUser.php(152): wfDeprecatedMsg(string, string, boolean, integer)
#5 /srv/mediawiki/php-1.40.0-wmf.14/includes/parser/Parser.php(3215): MediaWiki\StubObject\StubGlobalUser->__destruct()
#6 /srv/mediawiki/php-1.40.0-wmf.14/includes/parser/PPFrame_Hash.php(275): Parser->braceSubstitution(array, PPFrame_Hash)
#7 /srv/mediawiki/php-1.40.0-wmf.14/includes/parser/Parser.php(2947): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#8 /srv/mediawiki/php-1.40.0-wmf.14/includes/parser/Parser.php(1606): Parser->replaceVariables(string)
#9 /srv/mediawiki/php-1.40.0-wmf.14/includes/parser/Parser.php(718): Parser->internalParse(string)
#10 /srv/mediawiki/php-1.40.0-wmf.14/includes/content/WikitextContentHandler.php(344): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#11 /srv/mediawiki/php-1.40.0-wmf.14/includes/content/ContentHandler.php(1746): WikitextContentHandler->fillParserOutput(WikitextContent, MediaWiki\Content\Renderer\ContentParseParams, ParserOutput)
#12 /srv/mediawiki/php-1.40.0-wmf.14/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput(WikitextContent, MediaWiki\Content\Renderer\ContentParseParams)
#13 /srv/mediawiki/php-1.40.0-wmf.14/includes/Revision/RenderedRevision.php(260): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput(WikitextContent, Title, integer, ParserOptions, boolean)
#14 /srv/mediawiki/php-1.40.0-wmf.14/includes/Revision/RenderedRevision.php(232): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(WikitextContent, boolean)
#15 /srv/mediawiki/php-1.40.0-wmf.14/includes/Revision/RevisionRenderer.php(227): MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string, array)
#16 /srv/mediawiki/php-1.40.0-wmf.14/includes/Revision/RevisionRenderer.php(164): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(MediaWiki\Revision\RenderedRevision, array)
#17 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}(MediaWiki\Revision\RenderedRevision, array)
#18 /srv/mediawiki/php-1.40.0-wmf.14/includes/Revision/RenderedRevision.php(199): call_user_func(Closure, MediaWiki\Revision\RenderedRevision, array)
#19 /srv/mediawiki/php-1.40.0-wmf.14/includes/poolcounter/PoolWorkArticleView.php(87): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#20 /srv/mediawiki/php-1.40.0-wmf.14/includes/poolcounter/PoolWorkArticleViewCurrent.php(92): PoolWorkArticleView->renderRevision()
#21 /srv/mediawiki/php-1.40.0-wmf.14/includes/poolcounter/PoolCounterWork.php(163): PoolWorkArticleViewCurrent->doWork()
#22 /srv/mediawiki/php-1.40.0-wmf.14/includes/page/ParserOutputAccess.php(299): PoolCounterWork->execute()
#23 /srv/mediawiki/php-1.40.0-wmf.14/includes/page/Article.php(718): MediaWiki\Page\ParserOutputAccess->getParserOutput(WikiPage, ParserOptions, MediaWiki\Revision\RevisionStoreRecord, integer)
#24 /srv/mediawiki/php-1.40.0-wmf.14/includes/page/Article.php(528): Article->generateContentOutput(User, ParserOptions, integer, OutputPage, array)
#25 /srv/mediawiki/php-1.40.0-wmf.14/includes/actions/ViewAction.php(78): Article->view()
#26 /srv/mediawiki/php-1.40.0-wmf.14/includes/MediaWiki.php(551): ViewAction->show()
#27 /srv/mediawiki/php-1.40.0-wmf.14/includes/MediaWiki.php(328): MediaWiki->performAction(Article, Title)
#28 /srv/mediawiki/php-1.40.0-wmf.14/includes/MediaWiki.php(913): MediaWiki->performRequest()
#29 /srv/mediawiki/php-1.40.0-wmf.14/includes/MediaWiki.php(571): MediaWiki->main()
#30 /srv/mediawiki/php-1.40.0-wmf.14/index.php(50): MediaWiki->run()
#31 /srv/mediawiki/php-1.40.0-wmf.14/index.php(46): wfIndexMain()
#32 /srv/mediawiki/w/index.php(3): require(string)
#33 {main}
Impact
Notes

A single occurrence. It seems to originate from the MediaWiki Parser.

Details

Request URL
https://de.wikipedia.org/wiki/Benutzer:Frank_C._M%C3%BCller/Neue_Seiten_der_Kollegen

Event Timeline

I have tried reaching the page and got a
[c947e528-e299-403b-a1a7-2699ef2aeb95] 2022-12-15 09:18:20: Fatal exception of type "Wikimedia\RequestTimeout\RequestTimeoutException"

Which might well be a different issue.

The page is transcluding many {{Special:NewPages}} with username filter and a limit of 500 for all namespaces

This seems to be about SpecialPageFactory::capturePath, where all globals are saved and restored after the parse.

I've also found this while using testing to see if I could make Special:Contact (MediaWiki-extensions-ContactPage) includable. It only occurred when attempting to save a page that had a valid contact form included. The main Special:Contact and any subpage that did not correspond to a valid form could be included fine.

Example:

The valid contact form (for reference):

image.png (1×1 px, 91 KB)

Transcluding Special:Contact:

image.png (117×1 px, 16 KB)

image.png (54×294 px, 3 KB)

Transclusing Special:Contact/testing (a form name not defined):

image.png (47×373 px, 4 KB)

image.png (118×939 px, 16 KB)

Transclusing Special:Contact/test (a valid contact form) - page cannot be saved as it only returns this depreciation warning:

image.png (66×371 px, 4 KB)

image.png (188×1 px, 51 KB)

Stack trace from the Special:Contact/test transclusion:

exception.trace
[error] [4e65c6ef0eea0da254ed6e6f] [no req]   PHP Deprecated: $wgUser reassignment detected [Called from PPFrame_Hash::expand]
#0 [internal function]: MWExceptionHandler::handleError()
#1 /var/www/html/w/includes/debug/MWDebug.php(381): trigger_error()
#2 /var/www/html/w/includes/debug/MWDebug.php(352): MWDebug::sendRawDeprecated()
#3 /var/www/html/w/includes/GlobalFunctions.php(795): MWDebug::deprecatedMsg()
#4 /var/www/html/w/includes/StubObject/StubGlobalUser.php(152): wfDeprecatedMsg()
#5 /var/www/html/w/includes/parser/Parser.php(3215): MediaWiki\StubObject\StubGlobalUser->__destruct()
#6 /var/www/html/w/includes/parser/PPFrame_Hash.php(275): Parser->braceSubstitution()
#7 /var/www/html/w/includes/parser/Parser.php(2947): PPFrame_Hash->expand()
#8 /var/www/html/w/includes/parser/Parser.php(1606): Parser->replaceVariables()
#9 /var/www/html/w/includes/parser/Parser.php(718): Parser->internalParse()
#10 /var/www/html/w/includes/content/WikitextContentHandler.php(344): Parser->parse()
#11 /var/www/html/w/includes/content/ContentHandler.php(1746): WikitextContentHandler->fillParserOutput()
#12 /var/www/html/w/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput()
#13 /var/www/html/w/includes/Revision/RenderedRevision.php(260): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput()
#14 /var/www/html/w/includes/Revision/RenderedRevision.php(232): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached()
#15 /var/www/html/w/includes/Revision/RevisionRenderer.php(227): MediaWiki\Revision\RenderedRevision->getSlotParserOutput()
#16 /var/www/html/w/includes/Revision/RevisionRenderer.php(164): MediaWiki\Revision\RevisionRenderer->combineSlotOutput()
#17 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}()
#18 /var/www/html/w/includes/Revision/RenderedRevision.php(199): call_user_func()
#19 /var/www/html/w/includes/Storage/DerivedPageDataUpdater.php(1471): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#20 /var/www/html/w/includes/Storage/PageEditStash.php(168): MediaWiki\Storage\DerivedPageDataUpdater->getCanonicalParserOutput()
#21 /var/www/html/w/includes/api/ApiStashEdit.php(198): MediaWiki\Storage\PageEditStash->parseAndCache()
#22 /var/www/html/w/includes/api/ApiMain.php(1903): ApiStashEdit->execute()
#23 /var/www/html/w/includes/api/ApiMain.php(878): ApiMain->executeAction()
#24 /var/www/html/w/includes/api/ApiMain.php(849): ApiMain->executeActionWithErrorHandling()
#25 /var/www/html/w/api.php(90): ApiMain->execute()
#26 /var/www/html/w/api.php(45): wfApiMain()
#27 {main}

The one comparison I can draw is that the error only occurs when the form is shown. Considering Special:NewPages and this both use HTMLForm with OOUI, it may be something related to that?

I'm having this error with mediawiki core with the last commit from December 13.

This error hides another error, in a unit test for php8.2 I have seen that:

1) ExtraParserTest::testSpecialPageTransclusionRestoresGlobalState
$wgUser reassignment detected [Called from PPFrame_Hash::expand in /workspace/src/includes/parser/PPFrame_Hash.php at line 276]

/workspace/src/includes/debug/MWDebug.php:381
/workspace/src/includes/debug/MWDebug.php:351
/workspace/src/includes/GlobalFunctions.php:793
/workspace/src/includes/StubGlobalUser.php:145
/workspace/src/includes/parser/Parser.php:3223
/workspace/src/includes/parser/PPFrame_Hash.php:276
/workspace/src/includes/parser/Parser.php:2955
/workspace/src/includes/parser/Parser.php:1610
/workspace/src/includes/parser/Parser.php:724
/workspace/src/tests/phpunit/includes/ExtraParserTest.php:66
/workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:500

Caused by
mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead

/workspace/src/vendor/wikimedia/html-formatter/src/HtmlFormatter.php:94
/workspace/src/includes/api/ApiHelp.php:210
/workspace/src/includes/api/ApiHelp.php:190
/workspace/src/includes/specials/SpecialApiHelp.php:90
/workspace/src/includes/specialpage/SpecialPage.php:701
/workspace/src/includes/specialpage/SpecialPageFactory.php:1428
/workspace/src/includes/specialpage/SpecialPageFactory.php:1490
/workspace/src/includes/parser/Parser.php:3223
/workspace/src/includes/parser/PPFrame_Hash.php:276
/workspace/src/includes/parser/Parser.php:2955
/workspace/src/includes/parser/Parser.php:1610
/workspace/src/includes/parser/Parser.php:724
/workspace/src/tests/phpunit/includes/ExtraParserTest.php:66
/workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:500

SpecialPageFactory::capturePath is not prepared to reset the user when an exception is thrown from the special page (Timeout in case of an includable special page).
In unit tests deprecation warnings are converted to exceptions

Change 876316 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] SpecialPageFactory: Always reset globals in ::capturePath

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

Change 876316 merged by jenkins-bot:

[mediawiki/core@master] SpecialPageFactory: Always reset globals in ::capturePath

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