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

Bug #7424 a+b-c parses to ac
Submitted: 2006-04-19 11:45 UTC Modified: 2009-10-23 00:39 UTC
From: alan dot harder at sun dot com Assigned: demrit
Status: Assigned Package: HTML_Safe (version 0.9.9beta)
PHP Version: Irrelevant OS: linux/any
Roadmaps: (Not assigned)    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: alan dot harder at sun dot com
New email:
PHP Version: Package Version: OS:

 

 [2006-04-19 11: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 10: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 13: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 16: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 11:06 UTC] checat (Konstantin Pelepelin)
replace "then" with "than", sorry.
 [2009-10-23 00: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.