Page MenuHomePhabricator

TimedMediaHandler: upstream getid3: PHP Warning: Undefined array key "TrackUID"
Open, LowPublicPRODUCTION ERROR

Description

Our upload system feeds chunked upload data, sometimes partial files, into TimedMediaHandler's upstream getid3 library. This can result in getid3 internals failing or leaking PHP warnings when unexpected incomplete or corrupt data gets parsed by the library, and these show up in our logs.

Actual behavior:

  • some incomplete or corrupt files result in PHP warnings in the internals of getid3 when assumptions are violated

Expected behavior:

  • these files should be silent in terms of logged error output. if they are corrupt this should be gracefully handled by the upload stash system without leaking internal details.

Recommended work:

  • check Matroska parser in 1.9.24 (current release, newer than our 1.9.23) to see if this warning can still happen there
  • if so, submit a patch upstream
  • update our usage to 1.9.24...
  • and then to next release if merging patches
Error
  • mwversion: 1.45.0-wmf.16
  • timestamp: 2025-08-28T16:12:55.097Z
  • phpversion: 8.1.33
  • reqId: ecaab752-a2f6-4d66-98c2-812875d2e4ae
  • Find reqId in Logstash
normalized_message
[{reqId}] {exception_url}   PHP Warning: Undefined array key "TrackUID"
FrameLocationCall
from/srv/mediawiki/php-1.45.0-wmf.16/vendor/james-heinrich/getid3/getid3/module.audio-video.matroska.php(484)
#0/srv/mediawiki/php-1.45.0-wmf.16/vendor/james-heinrich/getid3/getid3/module.audio-video.matroska.php(484)MediaWiki\Exception\MWExceptionHandler::handleError(int, string, string, int)
#1/srv/mediawiki/php-1.45.0-wmf.16/vendor/james-heinrich/getid3/getid3/getid3.php(781)getid3_matroska->Analyze()
#2/srv/mediawiki/php-1.45.0-wmf.16/extensions/TimedMediaHandler/includes/Handlers/ID3Handler/ID3Handler.php(39)getID3->analyze(string)
#3/srv/mediawiki/php-1.45.0-wmf.16/extensions/TimedMediaHandler/includes/Handlers/WebMHandler/WebMHandler.php(19)MediaWiki\TimedMediaHandler\Handlers\ID3Handler\ID3Handler->getID3(string)
#4/srv/mediawiki/php-1.45.0-wmf.16/extensions/TimedMediaHandler/includes/Handlers/ID3Handler/ID3Handler.php(58)MediaWiki\TimedMediaHandler\Handlers\WebMHandler\WebMHandler->getID3(string)
#5/srv/mediawiki/php-1.45.0-wmf.16/includes/media/MediaHandler.php(245)MediaWiki\TimedMediaHandler\Handlers\ID3Handler\ID3Handler->getMetadata(Wikimedia\FileBackend\FSFile\FSFile, string)
#6/srv/mediawiki/php-1.45.0-wmf.16/includes/utils/MWFileProps.php(91)MediaHandler->getSizeAndMetadataWithFallback(Wikimedia\FileBackend\FSFile\FSFile, string)
#7/srv/mediawiki/php-1.45.0-wmf.16/includes/upload/UploadBase.php(528)MWFileProps->getPropsFromPath(string, string)
#8/srv/mediawiki/php-1.45.0-wmf.16/includes/upload/UploadBase.php(548)UploadBase->getFileProps()
#9/srv/mediawiki/php-1.45.0-wmf.16/includes/upload/UploadFromChunks.php(471)UploadBase->verifyPartialFile()
#10/srv/mediawiki/php-1.45.0-wmf.16/includes/upload/UploadFromChunks.php(96)UploadFromChunks->verifyChunk()
#11/srv/mediawiki/php-1.45.0-wmf.16/includes/api/ApiUpload.php(533)UploadFromChunks->tryStashFile(MediaWiki\User\User, bool)
#12/srv/mediawiki/php-1.45.0-wmf.16/includes/api/ApiUpload.php(369)MediaWiki\Api\ApiUpload->performStash(string)
#13/srv/mediawiki/php-1.45.0-wmf.16/includes/api/ApiUpload.php(260)MediaWiki\Api\ApiUpload->getChunkResult(array)
#14/srv/mediawiki/php-1.45.0-wmf.16/includes/api/ApiUpload.php(176)MediaWiki\Api\ApiUpload->getContextResult()
#15/srv/mediawiki/php-1.45.0-wmf.16/includes/api/ApiMain.php(2034)MediaWiki\Api\ApiUpload->execute()
#16/srv/mediawiki/php-1.45.0-wmf.16/includes/api/ApiMain.php(956)MediaWiki\Api\ApiMain->executeAction()
#17/srv/mediawiki/php-1.45.0-wmf.16/includes/api/ApiMain.php(927)MediaWiki\Api\ApiMain->executeActionWithErrorHandling()
#18/srv/mediawiki/php-1.45.0-wmf.16/includes/api/ApiEntryPoint.php(152)MediaWiki\Api\ApiMain->execute()
#19/srv/mediawiki/php-1.45.0-wmf.16/includes/MediaWikiEntryPoint.php(198)MediaWiki\Api\ApiEntryPoint->execute()
#20/srv/mediawiki/php-1.45.0-wmf.16/api.php(44)MediaWiki\MediaWikiEntryPoint->run()
#21/srv/mediawiki/w/api.php(3)require(string)
#22{main}
Impact
Notes

Details

Request URL
https://commons.wikimedia.org/w/api.php

Event Timeline

Jdlrobson-WMF moved this task from Incoming/Inbox to Backlog on the Reader Growth Team board.
Jdlrobson-WMF subscribed.

Brooke will look into this impact of this and move to "Refinement" and high if this is

bvibber subscribed.

Finally got a chance to look into this: the warning is in the upstream getid3 library, occuring during chunked upload, and may indicate a corrupt or simply incomplete input file (a TrackUID is mandatory on audio/video tracks, and it's being used here without actually confirming it's present in the Matroska parser in getid3).

Recommended work:

  • check current upstream getid3 code (1.9.24, newer than out 1.9.23, is a recent release) to see if it actually checks for TrackUID presence before using them
  • if so, update our library to the current release
  • if not, make a patch and submit it upstream
    • update our library after the next release
bvibber renamed this task from PHP Warning: Undefined array key "TrackUID" to TimedMediaHandler: upstream getid3: PHP Warning: Undefined array key "TrackUID".Oct 27 2025, 9:49 PM
bvibber updated the task description. (Show Details)
HSwan-WMF lowered the priority of this task from Medium to Low.Nov 19 2025, 5:58 PM

May do a different approach- removing warnings from getid3

^ this proposed solution, 2 pts.

To improve my understanding... we run security checks against all chunks ?
So we throw random data at parsers in the hopes they tell use what filetype they are (or in these cases, which filetypes they are not).
While doing this, we throw an partial mkv file at getID3, which then errors because it is missing part of the file ?