1--TEST--
2Various null return conditions of dim/obj assignments
3--FILE--
4<?php
5
6function test() {
7    $array = [PHP_INT_MAX => 42];
8    $true = true;
9
10    try {
11        var_dump($array[] = 123);
12    } catch (Error $e) {
13        echo $e->getMessage(), "\n";
14    }
15
16    try {
17        var_dump($array[[]] = 123);
18    } catch (Error $e) {
19        echo $e->getMessage(), "\n";
20    }
21
22    try {
23        var_dump($array[new stdClass] = 123);
24    } catch (Error $e) {
25        echo $e->getMessage(), "\n";
26    }
27
28    try {
29        var_dump($true[123] = 456);
30    } catch (Error $e) {
31        echo $e->getMessage(), "\n";
32    }
33
34    try {
35        var_dump($array[] += 123);
36    } catch (Error $e) {
37        echo $e->getMessage(), "\n";
38    }
39
40    try {
41        var_dump($array[[]] += 123);
42    } catch (Error $e) {
43        echo $e->getMessage(), "\n";
44    }
45
46    try {
47        var_dump($array[new stdClass] += 123);
48    } catch (Error $e) {
49        echo $e->getMessage(), "\n";
50    }
51
52    try {
53        var_dump($true[123] += 456);
54    } catch (Error $e) {
55        echo $e->getMessage(), "\n";
56    }
57
58    try {
59        var_dump($true->foo = 123);
60    } catch (Error $e) {
61        echo $e->getMessage(), "\n";
62    }
63    try {
64        var_dump($true->foo += 123);
65    } catch (Error $e) {
66        echo $e->getMessage(), "\n";
67    }
68}
69
70test();
71
72?>
73--EXPECT--
74Cannot add element to the array as the next element is already occupied
75Illegal offset type
76Illegal offset type
77Cannot use a scalar value as an array
78Cannot add element to the array as the next element is already occupied
79Illegal offset type
80Illegal offset type
81Cannot use a scalar value as an array
82Attempt to assign property "foo" on bool
83Attempt to assign property "foo" on bool
84