thumb.php: Fix undefined variable $width
authorSergio Santoro <santoro.srg@gmail.com>
Wed, 9 Jul 2014 21:29:41 +0000 (23:29 +0200)
committerKrinkle <krinklemail@gmail.com>
Wed, 9 Jul 2014 21:46:15 +0000 (21:46 +0000)
Follows-up 5ca94d2d26e80bb2a4ea9339a3adc31baf186d3a.

In thumb.php an undefined variable ($width) was used, triggering
fatal errors while processing requests that were passing thumbnail
width with px (pixel) suffix.

Change-Id: I2dc4f4d2979f8225d2a6211ec50cdc79438539a9

thumb.php

index c0042c2..89cc834 100644 (file)
--- a/thumb.php
+++ b/thumb.php
@@ -118,7 +118,7 @@ function wfStreamThumb( array $params ) {
        }
        if ( isset( $params['width'] ) && substr( $params['width'], -2 ) == 'px' ) {
                // strip the px (pixel) suffix, if found
-               $params['width'] = substr( $width, 0, strlen( $width ) - 2 );
+               $params['width'] = substr( $params['width'], 0, -2 );
        }
        if ( isset( $params['p'] ) ) {
                $params['page'] = $params['p'];