summaryrefslogtreecommitdiff
path: root/ext/spl/tests/bug45622.phpt
blob: a8fe2c464141d84a366ed09324871c91eeaddf1d (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
--TEST--
SPL: Bug #45622 (isset($arrayObject->p) misbehaves with ArrayObject::ARRAY_AS_PROPS set
--FILE--
<?php

class C extends ArrayObject {
	public $p = 'object property';
}	

$ao = new C(array('p'=>'array element'));
$ao->setFlags(ArrayObject::ARRAY_AS_PROPS);

echo "\n--> Access the real property:\n";
var_dump(isset($ao->p));
var_dump($ao->p);

echo "\n--> Remove the real property and access the array element:\n";
unset($ao->p);
var_dump(isset($ao->p));
var_dump($ao->p);

echo "\n--> Remove the array element and try access again:\n";
unset($ao->p);
var_dump(isset($ao->p));
var_dump($ao->p);

echo "\n--> Re-add the real property:\n";
$ao->p = 'object property';
var_dump(isset($ao->p));
var_dump($ao->p);
?>
--EXPECTF--

--> Access the real property:
bool(true)
%unicode|string%(15) "object property"

--> Remove the real property and access the array element:
bool(true)
%unicode|string%(13) "array element"

--> Remove the array element and try access again:
bool(false)

Notice: Undefined index: p in %s on line %d
NULL

--> Re-add the real property:
bool(true)
%unicode|string%(15) "object property"