From 67a93f613ee329f26112bcff3e5fe723f992c34e Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Thu, 27 Mar 2008 14:33:02 +0000 Subject: [PATCH] (bug 13500) For backward compatibility, permit "pxpx" and similar constructs to be used for specifying image sizes. This could use some parser tests, maybe, but I'm not sure those give correct results on my machine, so probably not worth it for me to try. --- includes/Parser.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index dfd43b6e63..afda767559 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -4423,7 +4423,9 @@ class Parser // Special case; width and height come in one variable together if( $type == 'handler' && $paramName == 'width' ) { $m = array(); - if ( preg_match( '/^([0-9]*)x([0-9]*)$/', $value, $m ) ) { + # (bug 13500) In both cases (width/height and width only), + # permit trailing "px" for backward compatibility. + if ( preg_match( '/^([0-9]*)x([0-9]*)\s*(?:px)?\s*$/', $value, $m ) ) { $width = intval( $m[1] ); $height = intval( $m[2] ); if ( $handler->validateParam( 'width', $width ) ) { @@ -4434,7 +4436,7 @@ class Parser $params[$type]['height'] = $height; $validated = true; } - } elseif ( is_numeric( trim( $value ) ) ) { + } elseif ( preg_match( '/^[0-9]*\s*(?:px)?\s*$/', $value ) ) { $width = intval( $value ); if ( $handler->validateParam( 'width', $width ) ) { $params[$type]['width'] = $width; -- 2.20.1