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