Skip to content

Commit 0f8b9eb

Browse files
committed
Add support for binary and octal number prefixes for INI settings
Closes GH-9560
1 parent d2288ec commit 0f8b9eb

11 files changed

+2455
-12
lines changed

Zend/tests/zend_ini/zend_ini_parse_quantity_binary_prefixes.phpt

Lines changed: 750 additions & 0 deletions
Large diffs are not rendered by default.

Zend/tests/zend_ini_parse_quantity_error.phpt renamed to Zend/tests/zend_ini/zend_ini_parse_quantity_error.phpt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ $tests = [
1313
'1X', # Unknown multiplier.
1414
'1.0K', # Non integral digits.
1515

16+
'0X', # Valid prefix with no value
17+
'0Z', # Invalid prefix
18+
'0XK', # Valid prefix with no value and multiplier
19+
20+
'++',
21+
'-+',
22+
'+ 25',
23+
'- 25',
24+
1625
# Null bytes
1726
" 123\x00K",
1827
"\x00 123K",
@@ -48,6 +57,41 @@ int(1)
4857
Warning: Invalid quantity "1.0K", interpreting as "1K" for backwards compatibility in %s%ezend_ini_parse_quantity_error.php on line %d
4958
int(1024)
5059

60+
# "0X"
61+
62+
Warning: Invalid quantity "0X": no digits after base prefix, interpreting as "0" for backwards compatibility in %s%ezend_ini_parse_quantity_error.php on line %d
63+
int(0)
64+
65+
# "0Z"
66+
67+
Warning: Invalid prefix "0Z", interpreting as "0" for backwards compatibility in %s%ezend_ini_parse_quantity_error.php on line %d
68+
int(0)
69+
70+
# "0XK"
71+
72+
Warning: Invalid quantity "0XK": no valid leading digits, interpreting as "0" for backwards compatibility in %s%ezend_ini_parse_quantity_error.php on line %d
73+
int(0)
74+
75+
# "++"
76+
77+
Warning: Invalid quantity "++": no valid leading digits, interpreting as "0" for backwards compatibility in %s%ezend_ini_parse_quantity_error.php on line %d
78+
int(0)
79+
80+
# "-+"
81+
82+
Warning: Invalid quantity "-+": no valid leading digits, interpreting as "0" for backwards compatibility in %s%ezend_ini_parse_quantity_error.php on line %d
83+
int(0)
84+
85+
# "+ 25"
86+
87+
Warning: Invalid quantity "+ 25": no valid leading digits, interpreting as "0" for backwards compatibility in %s%ezend_ini_parse_quantity_error.php on line %d
88+
int(0)
89+
90+
# "- 25"
91+
92+
Warning: Invalid quantity "- 25": no valid leading digits, interpreting as "0" for backwards compatibility in %s%ezend_ini_parse_quantity_error.php on line %d
93+
int(0)
94+
5195
# " 123\000K"
5296

5397
Warning: Invalid quantity " 123\x00K", interpreting as " 123K" for backwards compatibility in %s on line %d

0 commit comments

Comments
 (0)