Home » HTML » HTML_Template_IT » Bug #9501
incorrect parsing of string literal with setVariable()
Details
| Submitted | 2006-11-29 17:27 UTC |
|---|---|
| From | aa1 at addihome dot org |
| Assigned | dsp |
| Status | Closed |
| Package | HTML_Template_IT |
| PHP Version | 4.4.2 |
| OS | linux |
| Roadmaps | 1.3.0a1 |
Comments
[2006-11-29 17:27 UTC] aa1 at addihome dot org
Description:
------------
setVariable does not parse a string with a $ symbol and one or more digits as a literal. Rather it swallows up the $ and up to two digits. Examples:
Ex. 1:
setVariable("AMNT", '$45.33');
output => .33
Ex. 2:
$word = "Cost is \$" . '183.22');
setVariable("AMNT", $word);
output => Cost is 3.22
Ex. 3:
$word = 'Cost is $456.98';
setVariable("AMNT", $word);
output => Cost is 6.98
to work around this bug I use.
$word = addcslashes($word, '$');
or add a \ in single quotes before the $ as in \$.
[2006-11-30 14:48 UTC] dsp at php dot net
This bug has been fixed in CVS.
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.
[2006-11-30 22:06 UTC] dsp at php dot net
As long as it's not released you might use the option
$tpl->setOption("use_preg"=>false)