r78436 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78435‎ | r78436 | r78437 >
Date:13:33, 15 December 2010
Author:happy-melon
Status:ok
Tags:
Comment:
Better regexes for r78246.
Modified paths:
  • /trunk/phase3/includes/HTMLForm.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/HTMLForm.php
@@ -1078,7 +1078,7 @@
10791079
10801080 # http://dev.w3.org/html5/spec/common-microsyntaxes.html#real-numbers
10811081 # with the addition that a leading '+' sign is ok.
1082 - if ( !preg_match( '/^(\+|\-)?\d+(\.\d+)?(E(\+|\-)?\d+)?$/i', $value ) ) {
 1082+ if ( !preg_match( '/^((\+|\-)?\d+(\.\d+)?(E(\+|\-)?\d+)?)?$/i', $value ) ) {
10831083 return wfMsgExt( 'htmlform-float-invalid', 'parse' );
10841084 }
10851085
@@ -1121,7 +1121,7 @@
11221122 # phone numbers when you know that they are integers (the HTML5 type=tel
11231123 # input does not require its value to be numeric). If you want a tidier
11241124 # value to, eg, save in the DB, clean it up with intval().
1125 - if ( !preg_match( '/^(\+|\-)?\d*$/', trim( $value ) )
 1125+ if ( !preg_match( '/^((\+|\-)?\d+)?$/', trim( $value ) )
11261126 ) {
11271127 return wfMsgExt( 'htmlform-int-invalid', 'parse' );
11281128 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r784391.17: Merge some more revs from trunk: r78144, r78403, r78436catrope14:23, 15 December 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78246Follow-up to r64866: follow the HTML5 spec when validating floats and ints, a...happy-melon15:32, 12 December 2010

Status & tagging log