1--TEST-- 2Cache slot test 3--EXTENSIONS-- 4xmlreader 5--FILE-- 6<?php 7 8class Test1 { 9 function __construct(public string $localName) {} 10} 11 12#[AllowDynamicProperties] 13class Test2 extends XMLReader { 14} 15 16function readLocalName($obj) { 17 for ($i = 0; $i < 2; $i++) 18 var_dump($obj->localName); 19} 20 21function readTestProp($obj) { 22 for ($i = 0; $i < 2; $i++) 23 var_dump($obj->testProp); 24} 25 26$reader = XMLReader::fromString("<root/>"); 27$reader->read(); 28$test1 = new Test1("hello"); 29 30readLocalName($reader); 31readLocalName($test1); 32readLocalName($reader); 33 34$test2 = new Test2; 35$test2->testProp = 1; 36 37readTestProp($test2); 38readTestProp($reader); 39readTestProp($test2); 40 41?> 42--EXPECTF-- 43string(4) "root" 44string(4) "root" 45string(5) "hello" 46string(5) "hello" 47string(4) "root" 48string(4) "root" 49int(1) 50int(1) 51 52Warning: Undefined property: XMLReader::$testProp in %s on line %d 53NULL 54 55Warning: Undefined property: XMLReader::$testProp in %s on line %d 56NULL 57int(1) 58int(1) 59