1--TEST-- 2SPL: ArrayObject::setFlags basic usage with ArrayObject::ARRAY_AS_PROPS. Currently fails on php.net due to bug 45622. 3--FILE-- 4<?php 5class C extends ArrayObject { 6 public $p = 'object property'; 7} 8 9function access_p($ao) { 10 // isset 11 var_dump(isset($ao->p)); 12 // read 13 var_dump($ao->p); 14 // write 15 $ao->p = $ao->p . '.changed'; 16 var_dump($ao->p); 17} 18 19$ao = new C(array('p'=>'array element')); 20$ao->setFlags(ArrayObject::ARRAY_AS_PROPS); 21 22echo "\n--> Access the real property:\n"; 23access_p($ao); 24 25echo "\n--> Remove the real property and access the array element:\n"; 26unset($ao->p); 27access_p($ao); 28 29echo "\n--> Remove the array element and try access again:\n"; 30unset($ao->p); 31access_p($ao); 32?> 33--EXPECTF-- 34--> Access the real property: 35bool(true) 36string(15) "object property" 37string(23) "object property.changed" 38 39--> Remove the real property and access the array element: 40bool(true) 41string(13) "array element" 42string(21) "array element.changed" 43 44--> Remove the array element and try access again: 45bool(false) 46 47Warning: Undefined array key "p" in %s on line %d 48NULL 49 50Warning: Undefined array key "p" in %s on line %d 51string(8) ".changed" 52