Bug #70450 [NEW]: DOMXpath adds 
 to string

From: Date: Mon, 07 Sep 2015 14:00:03 +0000
Subject: Bug #70450 [NEW]: DOMXpath adds 
 to string
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195850@lists.php.net to get a copy of this message
From: flavio dot cambraia at yahoo dot com dot br Operating system: Windows PHP version: 5.5.29 Package: DOM XML related Bug Type: Bug Bug description:DOMXpath adds &#13; to string Description: ------------ The output shows an entity &#13; for every line break in $contents var. I am using PHP 5.5.8 build date Jan 8 2014 15:26:26 Test script: --------------- <?php $contents = '<!DOCTYPE html> <html lang="pt"><head><meta charset="utf-8"></head> <body> <div class="div_entry"> <div class="div_imagem"> <a href="test.html"> <img src="test.png" alt="" />Link to imagem</a> </div> <div class="div_product">This is a title for a product</div> <div class="div_price">R$50,00</div> </div>'; $doc = new DOMDocument(); $doc->loadHTML('<?xml encoding="UTF-8">' . $contents); $xpath = new DOMXpath($doc); $xquery = '//div[@class="div_entry"]'; $articles = $xpath->query($xquery); $registros = array(); foreach ($articles as $i => $article) { $registros[] = $article->ownerDocument->saveXML($article); } // end foreach echo "<pre>"; print_r($registros); echo "</pre>"; ?> -- Edit bug report at https://bugs.php.net/bug.php?id=70450&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70450&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70450&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70450&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70450&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70450&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70450&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70450&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70450&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70450&r=support Expected behavior: https://bugs.php.net/fix.php?id=70450&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70450&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70450&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70450&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70450&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70450&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70450&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70450&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70450&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70450&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70450&r=mysqlcfg

« previous php.bugs (#195850) next »