|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-02-21 11:09 UTC] divinity76 at gmail dot com
Description: ------------ DOMNode->textContent created with DOMDocument->loadHTML completely ignores <br> newlines. i guess Bug #32581 could be related, but this is for PHP5/7, that's for PHP4 Test script: --------------- <?php $domd=new DOMDocument(); $domd->loadHTML("<pre>line1<br/>line2\nline3</pre>"); var_dump($domd->textContent); Expected result: ---------------- string(17) "line1 line2 line3" //<<expected result when newlines are 1 byte long Actual result: -------------- string(16) "line1line2 line3"//<<actual result when newlines are 1 byte long PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 27 06:00:01 2025 UTC |
$domd->loadHTML(preg_replace('/<br\\s*?\/??>/i', PHP_EOL, $html)); seems to work