X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fhtmlform%2Ffields%2FHTMLIntField.php;h=02af7de98bfbcacbbb3cf1b2303bbb7b7f5fbca0;hb=508c30e38fe1db714f3bd99478c811b4094a9f7f;hp=b0148d987e4ea628bd2229ce8e0b011804fb96f3;hpb=99dbf4e1d4d7f18e02935bdb8cd3be4413ffe729;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/htmlform/fields/HTMLIntField.php b/includes/htmlform/fields/HTMLIntField.php index b0148d987e..02af7de98b 100644 --- a/includes/htmlform/fields/HTMLIntField.php +++ b/includes/htmlform/fields/HTMLIntField.php @@ -4,21 +4,21 @@ * A field that must contain a number */ class HTMLIntField extends HTMLFloatField { - function validate( $value, $alldata ) { + public function validate( $value, $alldata ) { $p = parent::validate( $value, $alldata ); if ( $p !== true ) { return $p; } - # http://www.w3.org/TR/html5/infrastructure.html#signed-integers + # https://www.w3.org/TR/html5/infrastructure.html#signed-integers # with the addition that a leading '+' sign is ok. Note that leading zeros # are fine, and will be left in the input, which is useful for things like # phone numbers when you know that they are integers (the HTML5 type=tel # input does not require its value to be numeric). If you want a tidier # value to, eg, save in the DB, clean it up with intval(). if ( !preg_match( '/^((\+|\-)?\d+)?$/', trim( $value ) ) ) { - return $this->msg( 'htmlform-int-invalid' )->parseAsBlock(); + return $this->msg( 'htmlform-int-invalid' ); } return true;