Page MenuHomePhabricator

"PHP Notice: A non well formed numeric value encountered" from NamespaceInfo on Special:RecentChanges
Closed, DuplicatePublicPRODUCTION ERROR

Description

Error
message
[XWfLKQpAAEEAAInM7PIAAADG] /w/index.php?associated=1&namespace=1%20waitfor%20delay%20'0:0:10'%20--%20&tagfilter=17&title=Spezial:Letzte%20%c3%84nderungen   ErrorException from line 165 of /srv/mediawiki/php-1.34.0-wmf.19/includes/title/NamespaceInfo.php: PHP Notice: A non well formed numeric value encountered
Impact

Line 165 42 hits, line 180 16 hits, line 246 15 hits so far in wmf.19, not seen before that.

Notes

Three errors seem connected. The only difference I can see is line number (165, 180, 246):

message
[{exception_id}] {exception_url} ErrorException from line 165 of /srv/mediawiki/php-1.34.0-wmf.19/includes/title/NamespaceInfo.php: PHP Notice: A non well formed numeric value encountered
message
[{exception_id}] {exception_url} ErrorException from line 246 of /srv/mediawiki/php-1.34.0-wmf.19/includes/title/NamespaceInfo.php: PHP Notice: A non well formed numeric value encountered
message
[{exception_id}] {exception_url} ErrorException from line 180 of /srv/mediawiki/php-1.34.0-wmf.19/includes/title/NamespaceInfo.php: PHP Notice: A non well formed numeric value encountered

Details

Request ID
XWfLKQpAAEEAAInM7PIAAADG
Request URL
bar.wikipedia.org/w/index.php?associated=1&namespace=1%20waitfor%20delay%20'0:0:10'%20--%20&tagfilter=17&title=Spezial:Letzte%20%c3%84nderungen
Stack Trace
trace
#0 /srv/mediawiki/php-1.34.0-wmf.19/includes/title/NamespaceInfo.php(165): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.34.0-wmf.19/includes/title/NamespaceInfo.php(245): NamespaceInfo->isTalk(string)
#2 /srv/mediawiki/php-1.34.0-wmf.19/includes/title/NamespaceInfo.php(276): NamespaceInfo->getSubject(string)
#3 /srv/mediawiki/php-1.34.0-wmf.19/includes/specialpage/ChangesListSpecialPage.php(1510): NamespaceInfo->getAssociated(string)
#4 [internal function]: ChangesListSpecialPage->{closure}(string)
#5 /srv/mediawiki/php-1.34.0-wmf.19/includes/specialpage/ChangesListSpecialPage.php(1516): array_map(Closure, array)
#6 /srv/mediawiki/php-1.34.0-wmf.19/includes/specialpage/ChangesListSpecialPage.php(996): ChangesListSpecialPage->buildQuery(array, array, array, array, array, FormOptions)
#7 /srv/mediawiki/php-1.34.0-wmf.19/includes/specialpage/ChangesListSpecialPage.php(629): ChangesListSpecialPage->getRows()
#8 /srv/mediawiki/php-1.34.0-wmf.19/includes/specials/SpecialRecentChanges.php(165): ChangesListSpecialPage->execute(NULL)
#9 /srv/mediawiki/php-1.34.0-wmf.19/includes/specialpage/SpecialPage.php(571): SpecialRecentChanges->execute(NULL)
#10 /srv/mediawiki/php-1.34.0-wmf.19/includes/specialpage/SpecialPageFactory.php(582): SpecialPage->run(NULL)
#11 /srv/mediawiki/php-1.34.0-wmf.19/includes/MediaWiki.php(296): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#12 /srv/mediawiki/php-1.34.0-wmf.19/includes/MediaWiki.php(892): MediaWiki->performRequest()
#13 /srv/mediawiki/php-1.34.0-wmf.19/includes/MediaWiki.php(523): MediaWiki->main()
#14 /srv/mediawiki/php-1.34.0-wmf.19/index.php(42): MediaWiki->run()
#15 /srv/mediawiki/w/index.php(3): require(string)
#16 {main}

Event Timeline

Removed from train blockers since it only happened in wmf.19.

ChangesListSpecialPage is not validating the parameters. It's assuming that the namespace parameter in the query string is a semicolon-delimited list of numbers. The URL here is invalid, and has garbage after the namespace parameter:

namespace=1%20waitfor%20delay%20'0:0:10'%20--%20

This will be parsed to int(1), which is probably correct, but it issues a notice.

The question is if we want to deal with bogus input differently from this. The notice is not really interesting, so we could just suppress it by explicitly casting to int. Or, we could abort. I think aborting isn't warranted here, because sometimes garbage does sneak into URLs (e.g., adjoining punctuation that gets included in an autolink). Probably it's best to silence the notice and continue.

daniel closed this task as Resolved.EditedAug 30 2019, 7:26 AM
daniel claimed this task.

From a quick look, it seems like ChangesListSpecialQuery was feeding bad values to NamespaceInfo. This appears to have been fixed since by adding the expandSymbolicNamespaceFilters( $namespaces ) method.

Fixed on master, closing.

Untagging CPT, tagging Growth, since ChangesListSpecialQuery is theirs.

@Simetrical it seems like the introduction of expandSymbolicNamespaceFilters() has fixed this, since it filters out unknown namespaces.

In general, NamespaceInfo should complain about bad input. It could even fail hard and throw an Invalid ArgumentException. Validating parameters is up to the frontend code, that is, the code that is processing form input. ChangesListSpecialQuery should check the parameters and complain to the user.

Re-opening, in case Growth-Team wants to follow up on the validation.

kostajh subscribed.

Tagging this to follow up in Q2, possibly.

Removing task assignee due to inactivity, as this open task has been assigned for more than two years. See the email sent to the task assignee on February 06th 2022 (and T295729).

Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome.

If this task has been resolved in the meantime, or should not be worked on ("declined"), please update its task status via "Add Action… 🡒 Change Status".

Also see https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator.

Krinkle renamed this task from NamespaceInfo.php: PHP Notice: A non well formed numeric value encountered to "PHP Notice: A non well formed numeric value encountered" from NamespaceInfo on Special:RecentChanges.Mar 28 2025, 3:24 AM

This seems to be happening again, per  T231551: "PHP Notice: A non well formed numeric value encountered" from NamespaceInfo on Special:RecentChanges. Not sure how to reproduce though.

This refers to itself. I believe you meant T253098, which looks like a duplicate. However, given that one was fixed, I'll mark this one as duplicate instead,