mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Merge branch 'PHP-8.3'
* PHP-8.3: Fix str_decrement() on "1"
This commit is contained in:
commit
1df82938b2
2 changed files with 4 additions and 1 deletions
|
@ -1289,7 +1289,7 @@ PHP_FUNCTION(str_decrement)
|
||||||
}
|
}
|
||||||
} while (carry && position-- > 0);
|
} while (carry && position-- > 0);
|
||||||
|
|
||||||
if (UNEXPECTED(carry || ZSTR_VAL(decremented)[0] == '0')) {
|
if (UNEXPECTED(carry || (ZSTR_VAL(decremented)[0] == '0' && ZSTR_LEN(decremented) > 1))) {
|
||||||
if (ZSTR_LEN(decremented) == 1) {
|
if (ZSTR_LEN(decremented) == 1) {
|
||||||
zend_string_release_ex(decremented, /* persistent */ false);
|
zend_string_release_ex(decremented, /* persistent */ false);
|
||||||
zend_argument_value_error(1, "\"%s\" is out of decrement range", ZSTR_VAL(str));
|
zend_argument_value_error(1, "\"%s\" is out of decrement range", ZSTR_VAL(str));
|
||||||
|
|
|
@ -28,6 +28,7 @@ $strictlyAlphaNumeric = [
|
||||||
"d",
|
"d",
|
||||||
"D",
|
"D",
|
||||||
"4",
|
"4",
|
||||||
|
"1",
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($strictlyAlphaNumeric as $s) {
|
foreach ($strictlyAlphaNumeric as $s) {
|
||||||
|
@ -77,3 +78,5 @@ string(1) "C"
|
||||||
string(1) "D"
|
string(1) "D"
|
||||||
string(1) "3"
|
string(1) "3"
|
||||||
string(1) "4"
|
string(1) "4"
|
||||||
|
string(1) "0"
|
||||||
|
string(1) "1"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue