bug69758.phpt 587 B

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