We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 296a095 + d9651a9 commit fa2c519Copy full SHA for fa2c519
ext/ffi/tests/gh9697.phpt
@@ -0,0 +1,14 @@
1
+--TEST--
2
+GH-9697 (array_walk($ffiInstance, function () {}) crashes due to expecting mutable array)
3
+--EXTENSIONS--
4
+ffi
5
+--INI--
6
+ffi.enable=1
7
+--FILE--
8
+<?php
9
+$x = FFI::new('int');
10
+array_walk($x, function($x) { echo "test\n"; });
11
+?>
12
+DONE
13
+--EXPECT--
14
ext/standard/array.c
@@ -1319,6 +1319,10 @@ static int php_array_walk(
1319
* levels of recursion. */
1320
zend_fcall_info fci = context->fci;
1321
1322
+ if (zend_hash_num_elements(target_hash) == 0) {
1323
+ return result;
1324
+ }
1325
+
1326
/* Set up known arguments */
1327
ZVAL_UNDEF(&args[1]);
1328
if (userdata) {
0 commit comments