source: src/router/php7/Zend/tests/assign_dim_obj_null_return.phpt @ 31874

Last change on this file since 31874 was 31874, checked in by brainslayer, 3 months ago

update php

File size: 1.2 KB
Line 
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    var_dump($array[] = 123);
11    var_dump($array[[]] = 123);
12    var_dump($array[new stdClass] = 123);
13    var_dump($true[123] = 456);
14
15    var_dump($array[] += 123);
16    var_dump($array[[]] += 123);
17    var_dump($array[new stdClass] += 123);
18    var_dump($true[123] += 456);
19
20    var_dump($true->foo = 123);
21    var_dump($true->foo += 123);
22}
23
24test();
25
26?>
27--EXPECTF--
28Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
29NULL
30
31Warning: Illegal offset type in %s on line %d
32NULL
33
34Warning: Illegal offset type in %s on line %d
35NULL
36
37Warning: Cannot use a scalar value as an array in %s on line %d
38NULL
39
40Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
41NULL
42
43Warning: Illegal offset type in %s on line %d
44NULL
45
46Warning: Illegal offset type in %s on line %d
47NULL
48
49Warning: Cannot use a scalar value as an array in %s on line %d
50NULL
51
52Warning: Attempt to assign property of non-object in %s on line %d
53NULL
54
55Warning: Attempt to assign property of non-object in %s on line %d
56NULL
Note: See TracBrowser for help on using the repository browser.