Page MenuHomePhabricator

Exception with thumb.php?w=xxxx: No width specified to ImageHandler::makeParamString
Closed, ResolvedPublicPRODUCTION ERROR

Description

This exception is very commonly logged at WMF:

2013-11-11 07:11:16 mw1157 commonswiki: [f882bb2e] /w/thumb.php?f=Wikibooks.png&w=50 Exception from line 61 of /usr/local/apache/common-local/php-1.23wmf2/includes/media/ImageHandler.php: No width specified to ImageHandler::makeParamString
#0 /usr/local/apache/common-local/php-1.23wmf2/includes/filerepo/file/File.php(808): ImageHandler->makeParamString(Array)
#1 /usr/local/apache/common-local/php-1.23wmf2/includes/filerepo/file/File.php(790): File->generateThumbName('Wikibooks-logo.png', Array)
#2 /usr/local/apache/common-local/php-1.23wmf2/thumb.php(187): File->thumbName(Array)
#3 /usr/local/apache/common-local/php-1.23wmf2/thumb.php(52): wfStreamThumb(Array)
#4 /usr/local/apache/common-local/php-1.23wmf2/thumb.php(35): wfThumbHandleRequest()
#5 /usr/local/apache/common-local/w/thumb.php(3): require('/usr/local/apache/common-local/php-1.23wmf2/thumb.php')
#6 {main}

It is apparently due to ccf89be91a4. The handling of backwards-compatible "w" parameters was moved to after the relevant thumbName() call.

This bug demonstrates a pre-existing error-handling issue. For example:

http://commons.wikimedia.org/w/thumb.php?f=Wikibooks.png

This throws an exception. It should show an error message instead. But some media types (for example, videos) allow the width to be omitted, so it's not correct to just check for a missing width parameter in thumb.php.

If the parameters are invalid, MediaHandler::normaliseParams() should return false, and indeed ImageHandler does just that:

if ( !isset( $params['width'] ) ) {

		return false;

}

...

if ( !$this->normaliseParams( $image, $params ) ) {

		return new TransformParameterError( $params );

}

So makeParamString() should probably fail silently, returning 0px-Wikibooks.png or some other similar garbage, so that parameter errors can be extracted from the MediaTransformOutput returned from transform().


Version: unspecified
Severity: normal

Details

Reference
bz56924

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:30 AM
bzimport set Reference to bz56924.
bzimport added a subscriber: Unknown Object (MLST).

Note that the exception with the "w" parameter specified occurs when the requested image is a redirect.

Change 94844 had a related patch set uploaded by Tim Starling:
thumb.php: map b/c params prior to attempting redirection

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

Change 94844 merged by jenkins-bot:
thumb.php: map b/c params prior to attempting redirection

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

tstarling: Did your patch fix most issues here? Wondering about the bug status and the current frequency in logs.

tstarling: Did your patch fix most issues here? Wondering about the bug status
and the current frequency in logs.

Jdforrester-WMF moved this task from Untriaged to Backlog on the Multimedia board.Sep 4 2015, 6:38 PM
Restricted Application added subscribers: Steinsplitter, Matanya, Aklapper. · View Herald TranscriptSep 4 2015, 6:38 PM

@Aklapper: seems like it's still happening in MW-1.28-release (WMF-deploy-2016-08-16_(1.28.0-wmf.15)):

 {
  "file": "/srv/mediawiki/php-1.28.0-wmf.15/includes/media/Bitmap.php",
  "line": 63,
  "function": "makeParamString",
  "class": "ImageHandler",
  "type": "->",
  "args": [
    "array"
  ]
},
{
  "file": "/srv/mediawiki/php-1.28.0-wmf.15/includes/filerepo/file/File.php",
  "line": 959,
  "function": "makeParamString",
  "class": "BitmapHandler",
  "type": "->",
  "args": [
    "array"
  ]
},
{
  "file": "/srv/mediawiki/php-1.28.0-wmf.15/includes/filerepo/file/File.php",
  "line": 942,
  "function": "generateThumbName",
  "class": "File",
  "type": "->",
  "args": [
    "string",
    "array"
  ]
},
{
  "file": "/srv/mediawiki/php-1.28.0-wmf.15/includes/filerepo/file/File.php",
  "line": 1061,
  "function": "thumbName",
  "class": "File",
  "type": "->",
  "args": [
    "array"
  ]
},
{
  "file": "/srv/mediawiki/php-1.28.0-wmf.15/extensions/TimedMediaHandler/TimedMediaIframeOutput.php",
  "line": 64,
  "function": "transform",
  "class": "File",
  "type": "->",
  "args": [
    "array"
  ]
},
{
  "file": "/srv/mediawiki/php-1.28.0-wmf.15/extensions/TimedMediaHandler/TimedMediaIframeOutput.php",
  "line": 34,
  "function": "outputIframe",
  "class": "TimedMediaIframeOutput",
  "type": "::",
  "args": [
    "Title"
  ]
},
{
  "file": "/srv/mediawiki/php-1.28.0-wmf.15/includes/Hooks.php",
  "line": 195,
  "function": "iframeHook",
  "class": "TimedMediaIframeOutput",
  "type": "::",
  "args": [
    "Title",
    "NULL",
    "RequestContext"
  ]
},
{
  "file": "/srv/mediawiki/php-1.28.0-wmf.15/includes/page/Article.php",
  "line": 121,
  "function": "run",
  "class": "Hooks",
  "type": "::",
  "args": [
    "string",
    "array"
  ]
},
{
  "file": "/srv/mediawiki/php-1.28.0-wmf.15/includes/page/Article.php",
  "line": 147,
  "function": "newFromTitle",
  "class": "Article",
  "type": "::",
  "args": [
    "Title",
    "RequestContext"
  ]
},
{
  "file": "/srv/mediawiki/php-1.28.0-wmf.15/includes/MediaWiki.php",
  "line": 403,
  "function": "newFromWikiPage",
  "class": "Article",
  "type": "::",
  "args": [
    "WikiFilePage",
    "RequestContext"
  ]
},
{
  "file": "/srv/mediawiki/php-1.28.0-wmf.15/includes/MediaWiki.php",
  "line": 287,
  "function": "initializeArticle",
  "class": "MediaWiki",
  "type": "->",
  "args": []
},
{
  "file": "/srv/mediawiki/php-1.28.0-wmf.15/includes/MediaWiki.php",
  "line": 749,
  "function": "performRequest",
  "class": "MediaWiki",
  "type": "->",
  "args": []
},
{
  "file": "/srv/mediawiki/php-1.28.0-wmf.15/includes/MediaWiki.php",
  "line": 521,
  "function": "main",
  "class": "MediaWiki",
  "type": "->",
  "args": []
},
{
  "file": "/srv/mediawiki/php-1.28.0-wmf.15/index.php",
  "line": 43,
  "function": "run",
  "class": "MediaWiki",
  "type": "->",
  "args": []
},
{
  "file": "/srv/mediawiki/w/index.php",
  "line": 3,
  "function": "include",
  "args": [
    "string"
  ]
}
Restricted Application added a project: Commons. · View Herald TranscriptAug 17 2016, 7:43 PM
Tgr added a subscriber: Tgr.Aug 17 2016, 8:41 PM

That's not a thumb.php stacktrace though. Seems like a TimedMediaHandler bug.

Restricted Application added a subscriber: Poyekhali. · View Herald TranscriptAug 17 2016, 8:41 PM
Tgr added a comment.Aug 17 2016, 8:51 PM

It also seems very rare (18 instances in the last 30 days). Most of those are thumb.php, actually: a missing width parameter on a redirect (e.g. /w/thumb.php?f=Wikibooks.png). That's a client error but should be handled more gracefully. The remaining few are from the TimedMediaIframeOutput hook, e.g. https://commons.wikimedia.org/wiki/File:Fred_Ott_Sneeze_L.gif?embedplayer=yes&uselang=fa Maybe that is also due to a missing query parameter, I am not familiar with TMH embed mode. In any case the files in the TMH errors are not redirects.

Krinkle closed this task as Resolved.Oct 27 2018, 9:21 PM
Krinkle claimed this task.
Krinkle added a subscriber: Krinkle.
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:12 PM