Date: 01/05/01
- Next message: Matt Friedman: "[phplib] Which DB is best? Mysql, Postgresql, Interbase..."
- Previous message: Tobias Nix: "[phplib] cvs-read"
- In reply to: Padraic Renaghan: "Re: [phplib] php4.0.4 and phplib template problems."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I just had this problem last night/this morning when moving a code base from test on 4.0.3pl1 to production 4.0.4. I experienced exactly what you described here - a template with ${varname} in a block (and only in a block) loses the first two digits of the value stuffed into varname. Luckily we got the bright idea to add a space after the $ to fix the problem. I'm just adding my vote to get this fixed properly and quickly. :)
On Thu, Jan 04, 2001 at 12:29:40PM -0500, Padraic Renaghan wrote:
> * Kartic Krishnamurthy <kaygee <email protected>> [Jan 4 12:12pm]:
> > Same case with me..my template driven pages are working fine with php-4.0.4.
> > But I tried the specific code posted by Padraic and that was printing 0.50
> > instead of $7.50.
>
> I should have also said that all other aspects of templates are
> working for me except for the substitution of values that have
> "$[0-9]+" like patterns in them.
>
> I tried everywhere between 1 and 5 "\" before the "$" - that didn't
> work. I also tried running the value through preg_quote() - that
> didn't work. The only workaround I have it to put a space between
> the "$" and the number - this results in "$ 7.50" which is Ok for
> now, but long-term I really don't want the space.
>
> I figure the right answer is to somehow escape backreferences in
> set_var() before the value is loaded into the array. We probably
> need to escape both "\1" and "$1" style input since I can't see how
> anyone would actually want either of those treated as a
> backreference when using templates. I created an escape_var()
> function inside the template class, but I the underlying problem in
> PHP 4.0.4 seems to be that the escaping of "$1" doesn't seem to
> work.
>
> Example:
> in set_var()
> ...
> $this->varvals[$varname] = $this->escape_val($value);
> ...
>
> then
> function escape_val($value='') {
> return str_replace ('$', '\$', $value);
> }
>
> --
> Padraic Renaghan /pad-rik ren-a-han/
> padraic <email protected>
> AOL IM(gaim): PadraicRenaghan
> http://renaghan.com/pcr/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: phplib-unsubscribe <email protected>
> For additional commands, e-mail: phplib-help <email protected>
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: Matt Friedman: "[phplib] Which DB is best? Mysql, Postgresql, Interbase..."
- Previous message: Tobias Nix: "[phplib] cvs-read"
- In reply to: Padraic Renaghan: "Re: [phplib] php4.0.4 and phplib template problems."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

