1--TEST--
2SPL: ArrayObject::__construct basic usage with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS. Currently fails on php.net due to bug 45622.
3--FILE--
4<?php
5class C {
6	public $prop = 'C::prop.orig';
7}
8
9class MyArrayObject extends ArrayObject {
10	public $prop = 'MyArrayObject::prop.orig';
11}
12
13echo "\n--> Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS:\n";
14$c = new C;
15$ao = new ArrayObject($c, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS);
16testAccess($c, $ao);
17
18echo "\n--> Access prop on instance of MyArrayObject with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS:\n";
19$c = new C;
20$ao = new MyArrayObject($c, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS);
21testAccess($c, $ao);
22
23function testAccess($c, $ao) {
24	echo "  - Iteration:\n";
25	foreach ($ao as $key=>$value) {
26		echo "      $key=>$value\n";
27	}
28
29	echo "  - Read:\n";
30	@var_dump($ao->prop, $ao['prop']);
31
32	echo "  - Write:\n";
33	$ao->prop = 'changed1';
34	$ao['prop'] = 'changed2';
35	var_dump($ao->prop, $ao['prop']);
36
37	echo "  - Isset:\n";
38	var_dump(isset($ao->prop), isset($ao['prop']));
39
40	echo "  - Unset:\n";
41	unset($ao->prop);
42	unset($ao['prop']);
43	var_dump($ao->prop, $ao['prop']);
44
45	echo "  - After:\n";
46	var_dump($ao, $c);
47}
48?>
49--EXPECTF--
50--> Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS:
51  - Iteration:
52      prop=>C::prop.orig
53  - Read:
54string(12) "C::prop.orig"
55string(12) "C::prop.orig"
56  - Write:
57string(8) "changed2"
58string(8) "changed2"
59  - Isset:
60bool(true)
61bool(true)
62  - Unset:
63
64Notice: Undefined index: prop in %s on line 39
65
66Notice: Undefined index: prop in %s on line 40
67
68Notice: Undefined index: prop in %s on line 40
69NULL
70NULL
71  - After:
72object(ArrayObject)#2 (1) {
73  ["storage":"ArrayObject":private]=>
74  object(C)#1 (0) {
75  }
76}
77object(C)#1 (0) {
78}
79
80--> Access prop on instance of MyArrayObject with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS:
81  - Iteration:
82      prop=>C::prop.orig
83  - Read:
84string(24) "MyArrayObject::prop.orig"
85string(12) "C::prop.orig"
86  - Write:
87string(8) "changed1"
88string(8) "changed2"
89  - Isset:
90bool(true)
91bool(true)
92  - Unset:
93
94Notice: Undefined index: prop in %s on line 40
95
96Notice: Undefined index: prop in %s on line 40
97NULL
98NULL
99  - After:
100object(MyArrayObject)#3 (1) {
101  ["storage":"ArrayObject":private]=>
102  object(C)#4 (0) {
103  }
104}
105object(C)#4 (0) {
106}
107