exception_015.phpt 499 B

1234567891011121314151617181920
  1. --TEST--
  2. Exceptions on improper access to string
  3. --FILE--
  4. <?php
  5. $s = "ABC";
  6. try {
  7. $s[] = "D";
  8. } catch (Error $e) {
  9. echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
  10. }
  11. $s[] = "D";
  12. ?>
  13. --EXPECTF--
  14. Exception: [] operator not supported for strings in %sexception_015.php on line %d
  15. Fatal error: Uncaught Error: [] operator not supported for strings in %sexception_015.php:%d
  16. Stack trace:
  17. #0 {main}
  18. thrown in %sexception_015.php on line %d