Annotation of embedaddon/php/ext/simplexml/tests/bug51615.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Bug #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: 
                     14: var_dump($html->body->span);
                     15: 
                     16: foreach ($html->body->span as $obj) {
                     17:        var_dump((string)$obj->title);
                     18: }
                     19: 
                     20: ?>
                     21: --EXPECTF--
                     22: Warning: DOMDocument::loadHTML(): error parsing attribute name in Entity, line: 1 in %s on line %d
                     23: 
                     24: Warning: DOMDocument::loadHTML(): error parsing attribute name in Entity, line: 1 in %s on line %d
1.1.1.2 ! misho      25: object(SimpleXMLElement)#%d (3) {
1.1       misho      26:   ["@attributes"]=>
                     27:   array(2) {
                     28:     ["title"]=>
                     29:     string(0) ""
                     30:     ["y"]=>
                     31:     string(0) ""
                     32:   }
                     33:   [0]=>
                     34:   string(1) "x"
1.1.1.2 ! misho      35:   [1]=>
        !            36:   string(1) "x"
1.1       misho      37: }
                     38: string(0) ""
                     39: string(0) ""

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>