Page MenuHomePhabricator

Warning: fread(): Length parameter must be greater than 0 in /var/www/html/w/includes/MimeMagic.php on line 648
Closed, ResolvedPublic

Description

The following API query:

/w/api.php?action=upload&format=json&filename=whatevs.jpg&stash=1&filesize=0&offset=0&chunk=...&token=7ff1207a75c6529a4fbb9414db128a0156f3993b%2B%5C

Produces the following:

<b>Warning</b>:  fread(): Length parameter must be greater than 0 in <b>/var/www/html/w/includes/MimeMagic.php</b> on line <b>648</b>

&filesize=0&offset=0 seems to be the important part, and you must attempt a chunked upload with &chunk and not a simple one with &file.

Event Timeline

(Silly of me to paste a token into a bug, but no worries, this is from my localhost testing wiki.)

Actually, &filesize=0 does not matter, but the &chunk file must be zero-length.

matmarex triaged this task as Medium priority.
matmarex edited projects, added MediaWiki-Uploading; removed MediaWiki-Action-API.
Restricted Application added a subscriber: Steinsplitter. · View Herald Transcript

Change 279315 had a related patch set uploaded (by Bartosz Dziewoński):
MimeMagic: Prevent PHP warning when trying to read zero bytes

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

Change 279315 merged by jenkins-bot:
MimeMagic: Prevent PHP warning when trying to read zero bytes

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