note 100393 deleted from function.htmlentities by danbrown
| From: | danbrown@php.net | Date: | Wed, 13 Oct 2010 22:09:18 +0000 |
| Subject: | note 100393 deleted from function.htmlentities by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173199@lists.php.net to get a copy of this message | ||
Note Submitter: embarrassed dot php dot net at softmoon-webware dot com
----
re: yet again my previous post:
there is a major functional bug in the last "if" statement, just before the call to
htmlentities(), within the tag handling section. There should be no test for $nl_to_br. The line
should read:
<?php
if (($x=strpos($sS, "pre"))!==FALSE and $x<2)
$PREflag=(boolean)$x;
?>
without this change, spaces will still be "collapsed" inside 'pre'
'/pre' tags. An earlier version has been in use for a year, and this one was tested for
(ahem, cough, cough) several hours...
Oh my face is so red!
And I forgot to mention the last option, $skip_Quotes, is mainly for internal use, but you may also
use it; note that it affects the spaces/tabs "toXHTML" .
The three arrays of data ($HTML_ENTS, $HTML_TAGS, and $Xchars) may be included in the function body,
or used "globally". If you use the function once per inclusion, put them in the body and
let them go through garbage collection automatically. If you use it a few times, make them global,
then unset them to free up memory for later heavy duty jobs. If you use it several times, or with
text containing a lot of HTML tags, consider making them static inside the function to save time
defining them, while containing them, especially as this function CALLS ITSELF on each tag, and they
are big arrays.