r65782 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65781‎ | r65782 | r65783 >
Date:04:51, 2 May 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Fixed bug in float parameter type validation
Modified paths:
  • /trunk/extensions/Validator/Validator.php (modified) (history)
  • /trunk/extensions/Validator/Validator_Functions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Validator/Validator_Functions.php
@@ -145,7 +145,8 @@
146146 }
147147
148148 /**
149 - * Wrapper for the native is_float function.
 149+ * Returns if the value is a floating point number.
 150+ * Does NOT check the type of the variable like the native is_float function.
150151 *
151152 * @param $value
152153 * @param array $metaData
@@ -153,6 +154,6 @@
154155 * @return boolean
155156 */
156157 public static function is_float( $value, array $metaData ) {
157 - return is_float( $value );
 158+ return preg_match( '/^\d+(\.\d+)?$/', $value );
158159 }
159160 }
Index: trunk/extensions/Validator/Validator.php
@@ -24,7 +24,7 @@
2525 die( 'Not an entry point.' );
2626 }
2727
28 -define( 'Validator_VERSION', '0.3 a3' );
 28+define( 'Validator_VERSION', '0.3 a4' );
2929
3030 // Constants indicating the strictness of the parameter validation.
3131 define( 'Validator_ERRORS_NONE', 0 );

Status & tagging log