From: vania at pandorasdream dot com Operating system: Windows XP PHP version: 5.0.0b3 (beta3) PHP Bug Type: DOM XML related Bug description: DOMXML LoadHTML throws exception on URL with "&"
Description: ------------ Using the example for LoadHTML the www.php.net site contains a URL with an ampersand (line 118 <a href="http://cvs.php.net/diff.php/php-src/NEWS?login=2&r1=1.1247.2.452&r2=1.1247.2.522">NEWS</a> file.). The error says it is looking for a missing ";", apparently thinking it should be an entity. When I remove the try/catch, no errors occur, but nothing gets printed. Using a different URL to a file without the & works correctly. Reproduce code: --------------- <?php try { $dom = new domdocument; @$dom->loadHTMLFile("http://www.php.net/"); $xp = new domxpath($dom); $result = $xp->query("/html/head/title"); print $result[0]->firstChild->data; } catch (exception $exc) { print $exc->getMessage()." at line ".$exc->getLine(); } ?> Expected result: ---------------- PHP: Hypertext Preprocessor Actual result: -------------- <?php try { $dom = new domdocument; @$dom->loadHTMLFile("http://www.php.net/"); $xp = new domxpath($dom); $result = $xp->query("/html/head/title"); print $result[0]->firstChild->data; } catch (exception $exc) { print $exc->getMessage()." at line ".$exc->getLine(); } ?> -- Edit bug report at http://bugs.php.net/?id=26926&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26926&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26926&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=26926&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=26926&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=26926&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=26926&r=needscript Try newer version: http://bugs.php.net/fix.php?id=26926&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=26926&r=support Expected behavior: http://bugs.php.net/fix.php?id=26926&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=26926&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=26926&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=26926&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26926&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=26926&r=dst IIS Stability: http://bugs.php.net/fix.php?id=26926&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=26926&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=26926&r=float