Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GH-11876: ini_parse_quantity() accepts invalid quantities
Closes GH-11910
- Loading branch information
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--TEST-- | ||
Invalid INI quantities, base prefix followed by stuff eaten by strtoull() | ||
--EXTENSIONS-- | ||
zend_test | ||
--FILE-- | ||
<?php | ||
|
||
var_dump(zend_test_zend_ini_parse_quantity('0x0x12')); | ||
|
||
var_dump(zend_test_zend_ini_parse_quantity('0b+10')); | ||
var_dump(zend_test_zend_ini_parse_quantity('0o+10')); | ||
var_dump(zend_test_zend_ini_parse_quantity('0x+10')); | ||
|
||
var_dump(zend_test_zend_ini_parse_quantity('0b 10')); | ||
var_dump(zend_test_zend_ini_parse_quantity('0o 10')); | ||
var_dump(zend_test_zend_ini_parse_quantity('0x 10')); | ||
|
||
var_dump(zend_test_zend_ini_parse_quantity('0g10')); | ||
var_dump(zend_test_zend_ini_parse_quantity('0m10')); | ||
var_dump(zend_test_zend_ini_parse_quantity('0k10')); | ||
|
||
--EXPECTF-- | ||
Warning: Invalid quantity "0x0x12": no digits after base prefix, interpreting as "0" for backwards compatibility in %s on line %d | ||
int(0) | ||
|
||
Warning: Invalid quantity "0b+10": no digits after base prefix, interpreting as "0" for backwards compatibility in %s on line %d | ||
int(0) | ||
|
||
Warning: Invalid quantity "0o+10": no digits after base prefix, interpreting as "0" for backwards compatibility in %s on line %d | ||
int(0) | ||
|
||
Warning: Invalid quantity "0x+10": no digits after base prefix, interpreting as "0" for backwards compatibility in %s on line %d | ||
int(0) | ||
|
||
Warning: Invalid quantity "0b 10": no digits after base prefix, interpreting as "0" for backwards compatibility in %s on line %d | ||
int(0) | ||
|
||
Warning: Invalid quantity "0o 10": no digits after base prefix, interpreting as "0" for backwards compatibility in %s on line %d | ||
int(0) | ||
|
||
Warning: Invalid quantity "0x 10": no digits after base prefix, interpreting as "0" for backwards compatibility in %s on line %d | ||
int(0) | ||
|
||
Warning: Invalid quantity "0g10": unknown multiplier "0", interpreting as "0" for backwards compatibility in %s on line %d | ||
int(0) | ||
|
||
Warning: Invalid quantity "0m10": unknown multiplier "0", interpreting as "0" for backwards compatibility in %s on line %d | ||
int(0) | ||
|
||
Warning: Invalid quantity "0k10": unknown multiplier "0", interpreting as "0" for backwards compatibility in %s on line %d | ||
int(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters