mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.2'
* PHP-8.2: Fix incorrect zval type_flags in preg_replace_callback_array() for immutable arrays
This commit is contained in:
commit
fced34ee1d
2 changed files with 17 additions and 1 deletions
|
@ -2438,7 +2438,12 @@ PHP_FUNCTION(preg_replace_callback_array)
|
|||
}
|
||||
|
||||
if (subject_ht) {
|
||||
RETURN_ARR(subject_ht);
|
||||
RETVAL_ARR(subject_ht);
|
||||
// Unset the type_flags of immutable arrays to prevent the VM from performing refcounting
|
||||
if (GC_FLAGS(subject_ht) & IS_ARRAY_IMMUTABLE) {
|
||||
Z_TYPE_FLAGS_P(return_value) = 0;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
RETURN_STR(subject_str);
|
||||
}
|
||||
|
|
11
ext/pcre/tests/gh10968.phpt
Normal file
11
ext/pcre/tests/gh10968.phpt
Normal file
|
@ -0,0 +1,11 @@
|
|||
--TEST--
|
||||
GH-10968: preg_replace_callback_array() segmentation fault
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(preg_replace_callback_array([], []));
|
||||
var_dump(preg_replace_callback_array([], ''));
|
||||
?>
|
||||
--EXPECT--
|
||||
array(0) {
|
||||
}
|
||||
string(0) ""
|
Loading…
Add table
Add a link
Reference in a new issue