File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ PHP NEWS
14
14
. Fixed bug #80537 (Wrong parameter type in DOMElement::removeAttributeNode
15
15
stub). (Nikita)
16
16
17
+ - Filter:
18
+ . Fixed bug #80584 (0x and 0X are considered valid hex numbers by
19
+ filter_var()). (girgias)
20
+
17
21
- MySQLi:
18
22
. Fixed bug #67983 (mysqlnd with MYSQLI_OPT_INT_AND_FLOAT_NATIVE fails to
19
23
interpret bit columns). (Nikita)
Original file line number Diff line number Diff line change @@ -233,6 +233,9 @@ void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
233
233
p ++ ; len -- ;
234
234
if (allow_hex && (* p == 'x' || * p == 'X' )) {
235
235
p ++ ; len -- ;
236
+ if (len == 0 ) {
237
+ RETURN_VALIDATION_FAILED
238
+ }
236
239
if (php_filter_parse_hex (p , len , & ctx_value ) < 0 ) {
237
240
error = 1 ;
238
241
}
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #80584: "0x" and "0X" are considered valid hex numbers by filter_var()
3
+ --SKIPIF--
4
+ <?php
5
+ if (!extension_loaded ('filter ' )) die ('skip filter extension not available ' );
6
+ ?>
7
+ --FILE--
8
+ <?php
9
+ var_dump (filter_var ('0x ' , FILTER_VALIDATE_INT , FILTER_FLAG_ALLOW_HEX ));
10
+ var_dump (filter_var ('0X ' , FILTER_VALIDATE_INT , FILTER_FLAG_ALLOW_HEX ));
11
+ var_dump (filter_var ('' , FILTER_VALIDATE_INT , FILTER_FLAG_ALLOW_HEX ));
12
+ var_dump (filter_var ('0 ' , FILTER_VALIDATE_INT , FILTER_FLAG_ALLOW_HEX ));
13
+ ?>
14
+ --EXPECT--
15
+ bool(false)
16
+ bool(false)
17
+ bool(false)
18
+ int(0)
You can’t perform that action at this time.
0 commit comments