1--TEST-- 2DOMNamedNodeMap string references 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$dom = new DOMDocument; 9$dom->loadXML('<a href="hi" foo="bar"/>'); 10 11$attributes = $dom->documentElement->attributes; 12 13var_dump(isset($attributes['href']), $attributes['href']->value); 14 15var_dump(isset($attributes['foo']), $attributes['foo']->value); 16 17$str = 'href'; 18$ref =& $str; 19var_dump(isset($attributes[$ref]), $attributes[$ref]->value); 20 21$str = 'foo'; 22$ref =& $str; 23var_dump(isset($attributes[$ref]), $attributes[$ref]->value); 24 25$str = 'this does not exist'; 26$ref =& $str; 27var_dump(isset($attributes[$ref]), $attributes[$ref]); 28 29$str = '0'; 30$ref =& $str; 31var_dump(isset($attributes[$ref]), $attributes[$ref]->value); 32 33$str = '1'; 34$ref =& $str; 35var_dump(isset($attributes[$ref]), $attributes[$ref]->value); 36 37$int = 0; 38$ref =& $int; 39var_dump(isset($attributes[$ref]), $attributes[$ref]->value); 40 41$int = 1; 42$ref =& $int; 43var_dump(isset($attributes[$ref]), $attributes[$ref]->value); 44 45?> 46--EXPECT-- 47bool(true) 48string(2) "hi" 49bool(true) 50string(3) "bar" 51bool(true) 52string(2) "hi" 53bool(true) 54string(3) "bar" 55bool(false) 56NULL 57bool(true) 58string(2) "hi" 59bool(true) 60string(3) "bar" 61bool(true) 62string(2) "hi" 63bool(true) 64string(3) "bar" 65