Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.10.1

Bug #7424 a+b-c parses to ac
Submitted: 2006-04-19 16:45 UTC
From: alan dot harder at sun dot com Assigned: demrit
Status: Closed Package: HTML_Safe (version 0.9.9beta)
PHP Version: Irrelevant OS: linux/any
Roadmaps: (Not assigned)    
Subscription  


 [2006-04-19 16:45 UTC] alan dot harder at sun dot com (Alan Harder)
Description: ------------ simple string with no html has some characters stripped out. seems the repackUTF7* functions do this. Test script: --------------- $parser =& new HTML_Safe(); $x = $parser->parse('a+b-c'); var_dump($x); Expected result: ---------------- string(5) "a+b-c" Actual result: -------------- string(2) "ac"

Comments

 [2006-05-30 15:05 UTC] bolk at php dot net (Evgeny Stepanischev)
I've to use next patch: function repackUTF7($str) { return preg_replace_callback('!\+([0-9a-zA-Z/]{2,})\-!', array($this, 'repackUTF7Callback'), $str); } function repackUTF7Callback($r) { $str = base64_decode($r[1]); if ($str === false) { return $r[1]; } $str = preg_replace_callback('/^((?:\x00.)*)((?:[^\x00].)+)/', array($this, 'repackUTF7Back'), $str); return preg_replace('/\x00(.)/', '$1', $str); }
 [2009-04-30 18:34 UTC] vodmal (Dmitry Vorobyev)
Test script: --------------- $parser = new SafeHTML(); $x = $parser->parse('+49-52 <br />'); var_dump($x); Expected result: ---------------- string(13) "+49-52 <br />" Actual result: -------------- string(12) "�52 <<r></r>"
 [2009-06-02 21:52 UTC] checat (Konstantin Pelepelin)
Isn't it better to replace all "+" with &#43;, disabling UTF-7 decoding, then "repack" them? AFAIR, + is not part of any HTML tag or attribute, and in attribute value &#43; works as well as in text, i.e.: <a href="http://www.google.com/search?q=SafeHTML&#43;UTF-7">test link</a>
 [2009-06-03 16:06 UTC] checat (Konstantin Pelepelin)
replace "then" with "than", sorry.
 [2009-10-23 05:39 UTC] demrit (Miguel Vazquez Gocobachi)
-Assigned To: bolk +Assigned To: demrit
I figured it will be resolve with the next release, just working and testing on.
 [2009-12-12 23:40 UTC] enzam (Enzam Hossain)
You can comment out "$doc = $this->repackUTF7($doc);" this line to solve the problem.
 [2010-04-06 03:15 UTC] demrit (Miguel Vazquez Gocobachi)
-Status: Assigned +Status: Closed
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.