1--TEST--
2Test count() function : usage variations - Infinitely recursive array
3--FILE--
4<?php
5/*
6 * Pass count() an infinitely recursive array as $var argument
7 * This will stop the script before it reaches the end.
8 */
9
10echo "*** Testing count() : usage variations ***\n";
11
12$array1 = array (1, 2, 'three');
13// get an infinitely recursive array
14$array1[] = &$array1;
15
16echo "\n-- \$mode not set: --\n";
17var_dump(count ($array1));
18
19echo "\n-- \$mode = 1: --\n";
20var_dump(count ($array1, 1));
21
22echo "Done";
23?>
24--EXPECTF--
25*** Testing count() : usage variations ***
26
27-- $mode not set: --
28int(4)
29
30-- $mode = 1: --
31
32Warning: count(): Recursion detected in %s on line %d
33int(4)
34Done
35