Merge branch 'PHP-8.3'

* PHP-8.3:
  Fix str_decrement() on "1"
This commit is contained in:
Ilija Tovilo 2023-10-02 16:42:16 +02:00
commit 1df82938b2
No known key found for this signature in database
GPG key ID: A4F5D403F118200A
2 changed files with 4 additions and 1 deletions

View file

@ -1289,7 +1289,7 @@ PHP_FUNCTION(str_decrement)
}
} 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) {
zend_string_release_ex(decremented, /* persistent */ false);
zend_argument_value_error(1, "\"%s\" is out of decrement range", ZSTR_VAL(str));

View file

@ -28,6 +28,7 @@ $strictlyAlphaNumeric = [
"d",
"D",
"4",
"1",
];
foreach ($strictlyAlphaNumeric as $s) {
@ -77,3 +78,5 @@ string(1) "C"
string(1) "D"
string(1) "3"
string(1) "4"
string(1) "0"
string(1) "1"