1--TEST--
2Converting undefined index/offset notice to exception
3--FILE--
4<?php
5
6set_error_handler(function($_, $msg) {
7    throw new Exception($msg);
8});
9
10$test = [];
11try {
12    $test[0] .= "xyz";
13} catch (Exception $e) {
14    echo $e->getMessage(), "\n";
15}
16var_dump($test);
17
18try {
19    $test["key"] .= "xyz";
20} catch (Exception $e) {
21    echo $e->getMessage(), "\n";
22}
23var_dump($test);
24
25unset($test);
26try {
27    $GLOBALS["test"] .= "xyz";
28} catch (Exception $e) {
29    echo $e->getMessage(), "\n";
30}
31try {
32    var_dump($test);
33} catch (Exception $e) {
34    echo $e->getMessage(), "\n";
35}
36
37?>
38--EXPECT--
39Undefined offset: 0
40array(0) {
41}
42Undefined index: key
43array(0) {
44}
45Undefined index: test
46Undefined variable: test
47