defaults.phpt 590 B

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. Skipping over default parameters
  3. --FILE--
  4. <?php
  5. function test1($a = 'a', $b = 'b') {
  6. echo "a: $a, b: $b\n";
  7. }
  8. function test2($a = SOME_CONST, $b = 'b') {
  9. echo "a: $a, b: $b\n";
  10. }
  11. function test3($a = SOME_OTHER_CONST, $b = 'b') {
  12. echo "a: $a, b: $b\n";
  13. }
  14. test1(b: 'B');
  15. define('SOME_CONST', 'X');
  16. test2(b: 'B');
  17. // NB: We also want to test the stack trace.
  18. test3(b: 'B');
  19. ?>
  20. --EXPECTF--
  21. a: a, b: B
  22. a: X, b: B
  23. Fatal error: Uncaught Error: Undefined constant "SOME_OTHER_CONST" in %s:%d
  24. Stack trace:
  25. #0 %s(%d): test3(NULL, 'B')
  26. #1 {main}
  27. thrown in %s on line %d