xref: /PHP-7.0/Zend/tests/bug40809.phpt (revision 4b953534)
1--TEST--
2Bug #40809 (Poor performance of ".=")
3--FILE--
4<?php
5error_reporting(E_ALL|E_STRICT);
6
7$num_increments = 100;
8$num_repeats = 1000;
9$increment = 50;
10
11/* Create some more holes to give the memory allocator something to
12 * work with. */
13$num = 5000;
14$a = Array();
15for ($i=0; $i<$num; $i++) {
16  $a[$i] = Array(1);
17}
18for ($i=0; $i<$num; $i++) {
19  $b[$i] = $a[$i][0];
20}
21unset($a);
22
23for ($i=0;$i<$num_repeats;$i++) {
24  $evil = "";
25  for ($j=0;$j<$num_increments;$j++) {
26    $evil .= str_repeat("a", $increment);
27  }
28  unset($evil);
29}
30echo "ok\n";
31?>
32--EXPECT--
33ok
34