PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_Safe » Bug #7424

a+b-c parses to ac

Details

Submitted2006-04-19 16:45 UTC
Fromalan dot harder at sun dot com
Assigneddemrit
StatusClosed
PackageHTML_Safe
PHP VersionIrrelevant
OSlinux/any
Roadmaps(Not assigned)

Comments

[2006-04-19 16:45 UTC] alan dot harder at sun dot com

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"

[2006-05-30 15:05 UTC] bolk at php dot net

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);
}