Page MenuHomePhabricator

TypeError: TimedMediaHandler::getSteppedThumbWidth(): Argument #2 ($requestWidth) must be of type int, float given
Open, Needs TriagePublicPRODUCTION ERROR

Description

Error
  • service.version: 1.47.0-wmf.1
  • timestamp: 2026-05-13T08:15:08.553Z
  • labels.phpversion: 8.3.30
  • trace.id: b4ab7406-2db7-4a38-99e6-c83dc2642e5c
  • Find trace.id in Logstash
labels.normalized_message
[{reqId}] {exception_url}   TypeError: MediaWiki\TimedMediaHandler\TimedMediaHandler::getSteppedThumbWidth(): Argument #2 ($requestWidth) must be of type int, float given, called in /srv/mediawiki/php-1.47.0-wmf.1/extensions/TimedMediaHandler/includes/Tim
FrameLocationCall
from/srv/mediawiki/php-1.47.0-wmf.1/extensions/TimedMediaHandler/includes/TimedMediaHandler.php(196)
#0/srv/mediawiki/php-1.47.0-wmf.1/extensions/TimedMediaHandler/includes/TimedMediaHandler.php(169)MediaWiki\TimedMediaHandler\TimedMediaHandler->getSteppedThumbWidth(MediaWiki\FileRepo\File\LocalFile, float, int, int)
#1/srv/mediawiki/php-1.47.0-wmf.1/includes/FileRepo/File/File.php(1285)MediaWiki\TimedMediaHandler\TimedMediaHandler->normaliseParams(MediaWiki\FileRepo\File\LocalFile, array)
#2/srv/mediawiki/php-1.47.0-wmf.1/includes/Linker/Linker.php(802)MediaWiki\FileRepo\File\File->transform(array)
#3/srv/mediawiki/php-1.47.0-wmf.1/includes/Api/ApiQueryImageInfo.php(586)MediaWiki\Linker\Linker::processResponsiveImages(MediaWiki\FileRepo\File\LocalFile, MediaWiki\TimedMediaHandler\TimedMediaTransformOutput, array)
#4/srv/mediawiki/php-1.47.0-wmf.1/includes/Api/ApiQueryImageInfo.php(227)MediaWiki\Api\ApiQueryImageInfo::getInfo(MediaWiki\FileRepo\File\LocalFile, array, MediaWiki\Api\ApiResult, array, array)
#5/srv/mediawiki/php-1.47.0-wmf.1/includes/Api/ApiQuery.php(735)MediaWiki\Api\ApiQueryImageInfo->execute()
#6/srv/mediawiki/php-1.47.0-wmf.1/includes/Api/ApiMain.php(2045)MediaWiki\Api\ApiQuery->execute()
#7/srv/mediawiki/php-1.47.0-wmf.1/includes/Api/ApiMain.php(949)MediaWiki\Api\ApiMain->executeAction()
#8/srv/mediawiki/php-1.47.0-wmf.1/includes/Api/ApiMain.php(920)MediaWiki\Api\ApiMain->executeActionWithErrorHandling()
#9/srv/mediawiki/php-1.47.0-wmf.1/includes/Api/ApiEntryPoint.php(138)MediaWiki\Api\ApiMain->execute()
#10/srv/mediawiki/php-1.47.0-wmf.1/includes/MediaWikiEntryPoint.php(180)MediaWiki\Api\ApiEntryPoint->execute()
#11/srv/mediawiki/php-1.47.0-wmf.1/api.php(30)MediaWiki\MediaWikiEntryPoint->run()
#12/srv/mediawiki/w/api.php(3)require(string)
#13{main}
Impact
Notes
  • 1.47.0-wmf.1 is the previous version Still happens in current 1.47.0-wmf.2
  • Pretty much T422074; looks like an explicit cast to int might be missing here?

Details

MediaWiki Version
1.47.0-wmf.2
Request URL
https://commons.wikimedia.org/w/api.php?action=query&format=*&generator=*&gsrlimit=*&gsrnamespace=*&gsroffset=*&gsrsearch=*&iiprop=*&iiurlheight=*&iiurlwidth=*&prop=*&redirects=*
Related Changes in Gerrit:

Event Timeline

Aklapper updated the task description. (Show Details)
Aklapper changed Release Version from 1.47.0-wmf.1 to 1.47.0-wmf.2.

Change #1287036 had a related patch set uploaded (by SomeRandomDeveloper; author: SomeRandomDeveloper):

[mediawiki/core@master] MediaHandler: Cast width to an int before returning it

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

I couldn't reproduce this locally, but I found an issue with MediaHandler::fixBoxWidth(), which returns a float sometimes even though it's documented to return an int. This overrides $params['width'] at https://github.com/wikimedia/mediawiki-extensions-TimedMediaHandler/blob/c822315d877ce81b2053274697f3017a9416e68c/includes/TimedMediaHandler.php#L158, which is then used as $params['physicalWidth'] and passed to TimedMediaHandler::getSteppedThumbWidth() a few lines below.
I'm not 100% sure if this will fix the errors mentioned in this task, but it definitely looks like it could cause them.

Change #1287036 merged by jenkins-bot:

[mediawiki/core@master] MediaHandler: Cast width to an int before returning it

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

Change #1287369 had a related patch set uploaded (by TheDJ; author: SomeRandomDeveloper):

[mediawiki/core@REL1_46] MediaHandler: Cast width to an int before returning it

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

Change #1287369 merged by jenkins-bot:

[mediawiki/core@REL1_46] MediaHandler: Cast width to an int before returning it

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