Re: [phplib] Problems with PHP 4.0.4, template.inc, and the modified From: Padraic Renaghan (list <email protected>)
Date: 01/29/01

* John Mandeville <mandevil <email protected>> [01/29/01 12:40pm]
> I don't have the original message to include here. The problem was
> with templates changing text from something like "$50.00" to ".00" due
> to changes in the Perl-compatible regex engine in PHP 4.0.4.
>
> The original poster had tried escaping with, for example, preg_quote().
> At best, you'll get the backslashes retained in your final html
> output, and at worst, you'll screw up template.inc if you do this.
> Instead, change dollar signs to "&#36;" entities. But don't fully
> entify with htmlentities(), or else you'll lose the braces that
> template.inc needs.
>
> The following diff -c on template.inc has, so far as I've tested it
> (which isn't much), solved the problem. Your mileage may vary. This
> change only entifies a dollar sign when followed by a digit. If you
> want template.inc to de-entify the dollar signs before you actually use
> the page, add the appropriate ereg_replace line as a new first line to
> finish(). The original template.inc in the diff is from version 7.2c.
> My admittedly scanty tests were with PHP 4.0.4p1.

Though this is a good interim fix for your specific application, I think
we need to figure out the "right" way to do this before applying the
patch to PHPLIB. The problem that I'll have is that I frequently use
templates to generate email text, which is not HTML. I send an order
confirmation that includes the total cost for example, say "$50.00". The
HTML entities don't work with email since it is not an HTML email.

I still plan on testing the PHP CVS code which supposedly fixes the
problem, or at least lets escaping work properly. At least that is what
the close message to my PHP bug report said.

Padraic

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>