summaryrefslogtreecommitdiff
path: root/Zend/tests/bug75921.phpt
blob: a8649262b5521d2b987a1f5eb625403087c9b301 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
--TEST--
Bug #75921: Inconsistent error when creating stdObject from empty variable
--FILE--
<?php

try {
    $null->a = 42;
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}
var_dump($null);
unset($null);

try {
    $null->a['hello'] = 42;
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}
var_dump($null);
unset($null);

try {
    $null->a->b = 42;
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}
var_dump($null);
unset($null);

try {
    $null->a['hello']->b = 42;
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}
var_dump($null);
unset($null);

try {
    $null->a->b['hello'] = 42;
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}
var_dump($null);
unset($null);

?>
--EXPECTF--
Attempt to assign property 'a' of non-object

Warning: Undefined variable: null in %s on line %d
NULL
Attempt to modify property 'a' of non-object

Warning: Undefined variable: null in %s on line %d
NULL
Attempt to modify property 'a' of non-object

Warning: Undefined variable: null in %s on line %d
NULL
Attempt to modify property 'a' of non-object

Warning: Undefined variable: null in %s on line %d
NULL
Attempt to modify property 'a' of non-object

Warning: Undefined variable: null in %s on line %d
NULL