prev_error2.phpt 640 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. prev - ensure warning is received when passing an indirect temporary.
  3. --FILE--
  4. <?php
  5. /* Prototype : mixed prev(array $array_arg)
  6. * Description: Move array argument's internal pointer to the previous element and return it
  7. * Source code: ext/standard/array.c
  8. */
  9. /*
  10. * Pass temporary variables to prev() to test behaviour
  11. */
  12. function f() {
  13. $array = array(1,2);
  14. end($array);
  15. return $array;
  16. }
  17. echo "\n-- Passing an indirect temporary variable --\n";
  18. var_dump(prev(f()));
  19. ?>
  20. --EXPECTF--
  21. -- Passing an indirect temporary variable --
  22. Strict Standards: Only variables should be passed by reference in %s on line %d
  23. int(1)