- if ( preg_match( '/^([0-9]*)x([0-9]*)$/', $value, $m ) ) {
- $params[$type]['width'] = intval( $m[1] );
- $params[$type]['height'] = intval( $m[2] );
+ # (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 ) ) {
+ $params[$type]['width'] = $width;
+ $validated = true;
+ }
+ if ( $handler->validateParam( 'height', $height ) ) {
+ $params[$type]['height'] = $height;
+ $validated = true;
+ }
+ } elseif ( preg_match( '/^[0-9]*\s*(?:px)?\s*$/', $value ) ) {
+ $width = intval( $value );
+ if ( $handler->validateParam( 'width', $width ) ) {
+ $params[$type]['width'] = $width;
+ $validated = true;
+ }
+ } // else no validation -- bug 13436
+ } else {
+ if ( $type == 'handler' ) {
+ # Validate handler parameter
+ $validated = $handler->validateParam( $paramName, $value );