⚓ T357032 GlobalFunctions: PHP Notice: Uninitialized string offset: 0
Page MenuHomePhabricator

GlobalFunctions: PHP Notice: Uninitialized string offset: 0
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
labels.normalized_message
[{reqId}] {exception_url}   PHP Notice: Uninitialized string offset: 0
error.stack_trace
from /srv/mediawiki/php-1.42.0-wmf.17/includes/GlobalFunctions.php(1203)
#0 /srv/mediawiki/php-1.42.0-wmf.17/includes/GlobalFunctions.php(1203): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.42.0-wmf.17/extensions/CentralNotice/includes/specials/pagers/CentralNoticeCampaignLogPager.php(261): wfEscapeWikiText(string)
#2 /srv/mediawiki/php-1.42.0-wmf.17/extensions/CentralNotice/includes/specials/pagers/CentralNoticeCampaignLogPager.php(179): CentralNoticeCampaignLogPager->showInitialSettings(stdClass)
#3 /srv/mediawiki/php-1.42.0-wmf.17/includes/pager/ReverseChronologicalPager.php(134): CentralNoticeCampaignLogPager->formatRow(stdClass)
#4 /srv/mediawiki/php-1.42.0-wmf.17/includes/pager/IndexPager.php(594): MediaWiki\Pager\ReverseChronologicalPager->getRow(stdClass)
#5 /srv/mediawiki/php-1.42.0-wmf.17/extensions/CentralNotice/includes/specials/SpecialCentralNoticeLogs.php(265): MediaWiki\Pager\IndexPager->getBody()
#6 /srv/mediawiki/php-1.42.0-wmf.17/extensions/CentralNotice/includes/specials/SpecialCentralNoticeLogs.php(206): SpecialCentralNoticeLogs->showLog(string)
#7 /srv/mediawiki/php-1.42.0-wmf.17/includes/specialpage/SpecialPage.php(720): SpecialCentralNoticeLogs->execute(NULL)
#8 /srv/mediawiki/php-1.42.0-wmf.17/includes/specialpage/SpecialPageFactory.php(1653): MediaWiki\SpecialPage\SpecialPage->run(NULL)
#9 /srv/mediawiki/php-1.42.0-wmf.17/includes/actions/ActionEntryPoint.php(504): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#10 /srv/mediawiki/php-1.42.0-wmf.17/includes/actions/ActionEntryPoint.php(145): MediaWiki\Actions\ActionEntryPoint->performRequest()
#11 /srv/mediawiki/php-1.42.0-wmf.17/includes/MediaWikiEntryPoint.php(201): MediaWiki\Actions\ActionEntryPoint->execute()
#12 /srv/mediawiki/php-1.42.0-wmf.17/index.php(57): MediaWiki\MediaWikiEntryPoint->run()
#13 /srv/mediawiki/w/index.php(3): require(string)
#14 {main}
Impact

Unclear.

Notes

Noticed while watching logs for 1.42.0-wmf.17 (T354435), but it shows up in .16 as well.

Details

Request URL
https://meta.wikimedia.org/w/index.php?campaign=*&log_type=*&title=*

Event Timeline

Comes from wfEscapeWikiText: $first = strtr( $text[0], $repl3 );, so it's some form of non-empty input that results in an empty string. Helpful.

Change 999027 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/core@master] wfEscapeWikiText: Don't choke if the replaced wikitext is empty

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

Change 999027 merged by jenkins-bot:

[mediawiki/core@master] wfEscapeWikiText: Don't choke if the replaced wikitext is empty

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

I had a closer look at the code calling wfEscapeWikiText in these cases (there are just two cases: https://logstash.wikimedia.org/goto/ec976a7b937bb42b33390cf8a6e151a4), and the mystery inputs are null and false.

Change 1003559 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] Clean up wfEscapeWikiText() input types

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

Change 1003559 merged by jenkins-bot:

[mediawiki/core@master] Clean up wfEscapeWikiText() input types

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