bug21600.phpt 688 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. Bug #21600 (assign by reference function call changes variable contents)
  3. --INI--
  4. error_reporting=4095
  5. --FILE--
  6. <?php
  7. $tmp = array();
  8. $tmp['foo'] = "test";
  9. $tmp['foo'] = &bar($tmp['foo']);
  10. var_dump($tmp);
  11. unset($tmp);
  12. $tmp = array();
  13. $tmp['foo'] = "test";
  14. $tmp['foo'] = &fubar($tmp['foo']);
  15. var_dump($tmp);
  16. function bar($text){
  17. return $text;
  18. }
  19. function fubar($text){
  20. $text = &$text;
  21. return $text;
  22. }
  23. ?>
  24. --EXPECTF--
  25. Notice: Only variables should be assigned by reference in %sbug21600.php on line 4
  26. array(1) {
  27. ["foo"]=>
  28. string(4) "test"
  29. }
  30. Notice: Only variables should be assigned by reference in %sbug21600.php on line 11
  31. array(1) {
  32. ["foo"]=>
  33. string(4) "test"
  34. }