call_user_func_006.phpt 483 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. call_user_func() should error on reference arguments
  3. --FILE--
  4. <?php
  5. namespace Foo;
  6. function bar(&$ref) {
  7. $ref = 24;
  8. }
  9. $x = 42;
  10. $ref =& $x;
  11. \call_user_func('Foo\bar', $x);
  12. var_dump($x);
  13. $y = 42;
  14. $ref =& $y;
  15. call_user_func('Foo\bar', $y);
  16. var_dump($y);
  17. ?>
  18. --EXPECTF--
  19. Warning: Parameter 1 to Foo\bar() expected to be a reference, value given in %s on line %d
  20. int(42)
  21. Warning: Parameter 1 to Foo\bar() expected to be a reference, value given in %s on line %d
  22. int(42)