Page MenuHomePhabricator

Undefined index error after unpack() from MimeAnalyzer.php
Closed, ResolvedPublic

Description

Error

Request URL: POST /w/api.php
Request ID: urgpAMDkAAGdtcScAAADB

message
[{exception_id}] {exception_url} ErrorException from line 809 of /srv/mediawiki/php-1.34.0-wmf.5/includes/libs/mime/MimeAnalyzer.php: PHP Notice: Undefined index: 0
trace
#0 /srv/mediawiki/php-1.34.0-wmf.5/includes/libs/mime/MimeAnalyzer.php(809): MWExceptionHandler::handleError(integer, string, string, integer, array, array)
#1 /srv/mediawiki/php-1.34.0-wmf.5/includes/libs/mime/MimeAnalyzer.php(608): MimeAnalyzer->doGuessMimeType(string, boolean)
#2 /srv/mediawiki/php-1.34.0-wmf.5/includes/utils/MWFileProps.php(73): MimeAnalyzer->guessMimeType(string, boolean)
#3 /srv/mediawiki/php-1.34.0-wmf.5/includes/upload/UploadBase.php(506): MWFileProps->getPropsFromPath(string, string)
#4 /srv/mediawiki/php-1.34.0-wmf.5/includes/upload/UploadFromChunks.php(404): UploadBase->verifyPartialFile()
#5 /srv/mediawiki/php-1.34.0-wmf.5/includes/upload/UploadFromChunks.php(67): UploadFromChunks->verifyChunk()
#6 /srv/mediawiki/php-1.34.0-wmf.5/includes/api/ApiUpload.php(315): UploadFromChunks->tryStashFile(User, boolean)
#7 /srv/mediawiki/php-1.34.0-wmf.5/includes/api/ApiUpload.php(212): ApiUpload->performStash(string)
#8 /srv/mediawiki/php-1.34.0-wmf.5/includes/api/ApiUpload.php(132): ApiUpload->getChunkResult(array)
#9 /srv/mediawiki/php-1.34.0-wmf.5/includes/api/ApiUpload.php(104): ApiUpload->getContextResult()
#10 /srv/mediawiki/php-1.34.0-wmf.5/includes/api/ApiMain.php(1593): ApiUpload->execute()
#11 /srv/mediawiki/php-1.34.0-wmf.5/includes/api/ApiMain.php(531): ApiMain->executeAction()
#12 /srv/mediawiki/php-1.34.0-wmf.5/includes/api/ApiMain.php(502): ApiMain->executeActionWithErrorHandling()
#13 /srv/mediawiki/php-1.34.0-wmf.5/api.php(87): ApiMain->execute()
#14 /srv/mediawiki/w/api.php(3): include(string)

Impact

Unknown. Could be causing corruption. Might be unrecoverable, uncertain at this point.

Notes

Happened several hundred times over the last 30 days, since at least php-1.34.0-wmf.1, possibly earlier.

Last modification to the code was:

Event Timeline

Krinkle created this task.May 18 2019, 3:24 PM
Restricted Application added projects: Commons, Multimedia. · View Herald TranscriptMay 18 2019, 3:24 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

It looks like the indices of the array returned by unpack here actually begin at 1: https://www.php.net/manual/en/function.unpack.php#refsect1-function.unpack-notes

WDoranWMF triaged this task as Normal priority.Jun 25 2019, 1:00 PM
WDoranWMF added a subscriber: WDoranWMF.

We're going to move this into our team board to be scheduled into a next sprint for one of CPT's sub teams.

Tagging author (@Simetrical, Core Platform Team) and reviewer (@aaron).

Actually, I was the author of this bug, in rMWf12db3804882272794b4dafc72db1c5d787375bf. The change you linked to just preserved it.

Change 525472 had a related patch set uploaded (by Tim Starling; owner: Tim Starling):
[mediawiki/core@master] MimeAnalyzer: fix ZIP parsing failure

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

Change 525472 merged by jenkins-bot:
[mediawiki/core@master] MimeAnalyzer: fix ZIP parsing failure

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

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:07 PM
daniel closed this task as Resolved.Tue, Sep 24, 6:54 PM
daniel added a subscriber: daniel.

Looks like this is done.