From: [EMAIL PROTECTED] Operating system: linux 2.4.4 PHP version: 4.0CVS-2002-04-16 PHP Bug Type: DOM XML related Bug description: DomDocument->get_element_by_id() doesn't work
The following script returns bool(false): <?php $src = <<< _END <html> <head><title> Test </title></head> <body> <h1>Test</h1> <span id="test">Foo</span> </body> </html> _END; $doc = domxml_open_mem($src); $n = $doc->get_element_by_id("test"); var_dump($n); ?> Workaround: Use Xpath expressions to find the node: <?php $src = <<< _END <html> <head><title> Test </title></head> <body> <h1>Test</h1> <span id="test">Foo</span> </body> </html> _END; $doc = domxml_open_mem($src); $ctx = $doc->xpath_new_context(); $res = $ctx->xpath_eval("//*[@id='test']"); $n = $res->nodeset[0]; var_dump($n); ?> -- Edit bug report at http://bugs.php.net/?id=16647&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=16647&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=16647&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=16647&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=16647&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=16647&r=support Expected behavior: http://bugs.php.net/fix.php?id=16647&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=16647&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=16647&r=submittedtwice