bug51615.phpt 766 B

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