xref: /PHP-8.4/Zend/tests/bug69758.phpt (revision 497f9f2c)
1--TEST--
2Bug #69758 (Item added to array not being removed by array_pop/shift)
3--FILE--
4<?php
5$tokens     = array();
6$conditions = array();
7for ($i = 0; $i <= 10; $i++) {
8    $tokens[$i] = $conditions;
9
10    // First integer must be less than 8
11    // and second must be 8, 9 or 10
12    if ($i !== 0 && $i !== 8) {
13        continue;
14    }
15
16    // Add condition and then pop off straight away.
17    // Can also use array_shift() here.
18    $conditions[$i] = true;
19    $oldCondition = array_pop($conditions);
20}
21
22// Conditions should be empty.
23var_dump($conditions);
24?>
25--EXPECT--
26array(0) {
27}
28