1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.3' into PHP-8.4

* PHP-8.3:
  Fix memory leak in array_diff() with custom type checks
This commit is contained in:
Niels Dossche
2025-11-08 22:42:11 +01:00
3 changed files with 18 additions and 0 deletions

3
NEWS
View File

@@ -13,6 +13,9 @@ PHP NEWS
. Fixed bug GH-20329 (opcache.file_cache broken with full interned string
buffer). (Arnaud)
- Standard:
. Fix memory leak in array_diff() with custom type checks. (ndossche)
- Tidy:
. Fixed bug GH-20374 (PHP with tidy and custom-tags). (ndossche)

View File

@@ -5889,6 +5889,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();
}

View File

@@ -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