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 182c8ac + fa2c519 commit 626e909Copy full SHA for 626e909
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
@@ -1272,6 +1272,10 @@ static int php_array_walk(
1272
* levels of recursion. */
1273
zend_fcall_info fci = context->fci;
1274
1275
+ if (zend_hash_num_elements(target_hash) == 0) {
1276
+ return result;
1277
+ }
1278
+
1279
/* Set up known arguments */
1280
ZVAL_UNDEF(&args[1]);
1281
if (userdata) {
0 commit comments