Error
Request URL: commonswiki /wiki/File: … .jpg
Request ID: XRT8AgpAAEQAACgRp9oAAAAD
PHP Notice: A non well formed numeric value encountered
#0 /srv/mediawiki/php-1.34.0-wmf.11/includes/media/FormatMetadata.php(1424): MWExceptionHandler::handleError(integer, string, string, integer, array) #1 /srv/mediawiki/php-1.34.0-wmf.11/includes/media/FormatMetadata.php(689): FormatMetadata->formatCoords(string, string) #2 /srv/mediawiki/php-1.34.0-wmf.11/includes/media/FormatMetadata.php(88): FormatMetadata->makeFormattedData(array) #3 /srv/mediawiki/php-1.34.0-wmf.11/includes/media/MediaHandler.php(500): FormatMetadata::getFormattedData(array, RequestContext) #4 /srv/mediawiki/php-1.34.0-wmf.11/includes/media/ExifBitmapHandler.php(136): MediaHandler->formatMetadataHelper(array, RequestContext) #5 /srv/mediawiki/php-1.34.0-wmf.11/includes/filerepo/file/File.php(1849): ExifBitmapHandler->formatMetadata(LocalFile, RequestContext) #6 /srv/mediawiki/php-1.34.0-wmf.11/includes/page/ImagePage.php(126): File->formatMetadata(RequestContext) #7 /srv/mediawiki/php-1.34.0-wmf.11/includes/actions/ViewAction.php(68): ImagePage->view() #8 /srv/mediawiki/php-1.34.0-wmf.11/includes/MediaWiki.php(499): ViewAction->show() #9 /srv/mediawiki/php-1.34.0-wmf.11/includes/MediaWiki.php(294): MediaWiki->performAction(ImagePage, Title) #10 /srv/mediawiki/php-1.34.0-wmf.11/includes/MediaWiki.php(884): MediaWiki->performRequest() #11 /srv/mediawiki/php-1.34.0-wmf.11/includes/MediaWiki.php(515): MediaWiki->main() #12 /srv/mediawiki/php-1.34.0-wmf.11/index.php(42): MediaWiki->run() #13 /srv/mediawiki/w/index.php(3): require(string)
Impact
The error is unhandled by the code and not made fatal by PHP, as such the code is continuing to execute without being aware of the problem and thus creates output that appears valid and as intended but actually isn't.
In this case, it seems the internal EXIF data from the uploaded photo is:
{ "name": "GPSLatitude", "value": "1/1" }, { "name": "GPSLongitude", "value": "1/1" },
But is shown on Commons as:
Latitude | 1° 0′ 0″ N |
Longitude | 1° 0′ 0″ E |
If this is valid and correct, it should produce it without an application-level error.
If this is not correct, it should handled in some way (e.g. skip, or a placeholder message informing the user).
Notes
From Logstash:
- Observed ~ 250 times in the last 30 days, since the deployment of 1.34-wmf.6 (possibly earlier).
- Affects commons.wikimedia.org and en.wikipedia.org most, but also seen on it.wikipedia.org, zh.wikipedia.org, and de.wikipedia.org.
The low frequency is in part because only PHP 7.2 is able to detect this error. The actual frequency is likely much higher given most traffic is served by HHVM still.