Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ext/standard/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -5762,6 +5762,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();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Loading