xref: /PHP-7.4/ext/standard/tests/array/bug12776.phpt (revision cf0a0f09)
1--TEST--
2Bug #12776 (array_walk crash)
3--FILE--
4<?php
5
6function test($val,$key)
7{
8	global $globalArray;
9	$globalArray[]=$key; // this will end up crashing
10	$globalArray[]=(string)$key; // this will end up OK
11	print "val: $val; key: $key\n"; flush();
12}
13
14$arr=array('k'=>'v');
15array_walk($arr,'test');
16
17print "First value: ".$globalArray[0];
18
19print "\nDone\n";
20
21?>
22--EXPECT--
23val: v; key: k
24First value: k
25Done
26