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
2 changes: 1 addition & 1 deletion ext/standard/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -6628,7 +6628,7 @@ static zend_result php_array_find(const HashTable *array, zend_fcall_info fci, z

if (retval_true) {
if (result_value != NULL) {
ZVAL_COPY(result_value, &args[0]);
ZVAL_COPY_DEREF(result_value, &args[0]);
}

if (result_key != NULL) {
Expand Down
11 changes: 11 additions & 0 deletions ext/standard/tests/array/gh15982.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--TEST--
GH-15982 (Assertion failure with array_find when references are involved)
--FILE--
<?php
$var = "hello";
$arrayWithRef = [];
$arrayWithRef[0] =& $var;
var_dump(array_find($arrayWithRef, fn () => true));
?>
--EXPECT--
string(5) "hello"
Loading