mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.5'
* PHP-8.5: Fix memory leak in array_diff() with custom type checks
This commit is contained in:
@@ -5909,6 +5909,7 @@ PHP_FUNCTION(array_diff)
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (Z_TYPE(args[i]) != IS_ARRAY) {
|
||||
zend_tmp_string_release(tmp_search_str);
|
||||
zend_argument_type_error(i + 1, "must be of type array, %s given", zend_zval_value_name(&args[i]));
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
array_diff() memory leak with custom type checks
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
array_diff([123], 'x');
|
||||
} catch (TypeError $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array_diff(): Argument #2 must be of type array, string given
|
||||
Reference in New Issue
Block a user