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