diff --git a/ext/standard/array.c b/ext/standard/array.c index a2fef8b14528..07ebd13e4282 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -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) { diff --git a/ext/standard/tests/array/gh15982.phpt b/ext/standard/tests/array/gh15982.phpt new file mode 100644 index 000000000000..2eb9eceb2318 --- /dev/null +++ b/ext/standard/tests/array/gh15982.phpt @@ -0,0 +1,11 @@ +--TEST-- +GH-15982 (Assertion failure with array_find when references are involved) +--FILE-- + true)); +?> +--EXPECT-- +string(5) "hello"