1--TEST-- 2Bug #51615 (PHP crash with wrong HTML in SimpleXML) 3--EXTENSIONS-- 4simplexml 5dom 6--FILE-- 7<?php 8 9$dom = new DOMDocument; 10$dom->loadHTML('<span title=""y">x</span><span title=""z">x</span>'); 11$html = simplexml_import_dom($dom); 12 13var_dump($html->body->span); 14 15foreach ($html->body->span as $obj) { 16 var_dump((string)$obj->title); 17} 18 19?> 20--EXPECTF-- 21Warning: DOMDocument::loadHTML(): error parsing attribute name in Entity, line: 1 in %s on line %d 22 23Warning: DOMDocument::loadHTML(): error parsing attribute name in Entity, line: 1 in %s on line %d 24object(SimpleXMLElement)#%d (3) { 25 ["@attributes"]=> 26 array(2) { 27 ["title"]=> 28 string(0) "" 29 ["y"]=> 30 string(0) "" 31 } 32 [0]=> 33 string(1) "x" 34 [1]=> 35 string(1) "x" 36} 37string(0) "" 38string(0) "" 39