bug72038.phpt 557 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. Bug #72038 (Function calls with values to a by-ref parameter don't always throw a notice)
  3. --FILE--
  4. <?php
  5. try {
  6. test($foo = new stdClass);
  7. var_dump($foo);
  8. } catch (Error $e) {
  9. echo $e->getMessage() . "\n";
  10. }
  11. try {
  12. test($bar = 2);
  13. var_dump($bar);
  14. } catch (Error $e) {
  15. echo $e->getMessage() . "\n";
  16. }
  17. test($baz = &$bar);
  18. var_dump($baz);
  19. function test(&$param) {
  20. $param = 1;
  21. }
  22. ?>
  23. --EXPECT--
  24. test(): Argument #1 ($param) cannot be passed by reference
  25. test(): Argument #1 ($param) cannot be passed by reference
  26. int(1)