[Phplib-trackers] [ phplib-Bugs-577922 ] Error: now disappears $xx and \
Brought to you by:
nhruby,
richardarcher
|
From: <no...@so...> - 2002-08-01 21:33:46
|
Bugs item #577922, was opened at 2002-07-06 06:35 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=403611&aid=577922&group_id=31885 Category: Template Group: 7.4pre1 Status: Open Resolution: None Priority: 5 Submitted By: Alejandro W. (awoywood) Assigned to: Richard Archer (richardarcher) Summary: Error: now disappears $xx and \ Initial Comment: Hi, I was looking for a correction to the disappearing $, then I tried this version of templates.inc But I found two errors: - templates.inc->set_var still eats "$xx", where x is a literal - templates.inc->set_var eats the \ in "\" if you do the following: $t->set_var(array( "t1" => " $es ", "t2" => " \23 " )); the variables inside the template object will became: t1="" and t2="$123". t1 is clearly wrong. t2 seems wrong too (I don't know the inner representation). After doing a $t->parse and a $t->p, in place of {t2} you will get a "$123" which is wrong. ---------------------------------------------------------------------- >Comment By: Richard Archer (richardarcher) Date: 2002-08-02 07:33 Message: Logged In: YES user_id=279311 Please post some code as an attachment which demonstrates this problem. So SF doesn't escape the sequence which causes the problem. Also, please include your copy of template.inc in the attachment. I still believe you're running a non-current version of template.inc. The logic in the current version seems to me to be unflawed. ...R. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2002-08-02 02:10 Message: Logged In: NO you must use \\23 ---------------------------------------------------------------------- Comment By: Richard Archer (richardarcher) Date: 2002-07-11 18:02 Message: Logged In: YES user_id=279311 I tested this, and it works fine for me. Test files attached... ---------------------------------------------------------------------- Comment By: Joe Winter (jwinter1) Date: 2002-07-11 05:21 Message: Logged In: YES user_id=206472 I second layne weathers on this. Also add ${noTDTags} to your testspecialchars.tpl where there is no space, no td tags, nothing, between the $ sign and the curly brace. ---------------------------------------------------------------------- Comment By: Richard Archer (richardarcher) Date: 2002-07-06 08:20 Message: Logged In: YES user_id=279311 I am confident that the current CVS version of template.inc behaves correctly in both these situations. Your second test result containing a "$" suggests to me that you're running an old version of template.inc. That kludge was removed from the script in April. The last change I made to resolve this issue was to run all variable values through preg_replace prior to substitution. While this incurs a performance hit over the previous kludges, it's practically guaranteed to result in the correct behaviour. I have attached my test script and template for this problem. The output consists of all template.inc's debugging output followed by a table of three columns. The first column is a description of the test, the second is the intended result as plain text and the third is the result after running through template. ...R. ---------------------------------------------------------------------- Comment By: Layne Weathers (layne_weathers) Date: 2002-07-06 06:48 Message: Logged In: YES user_id=278685 t1 depends completely on your setting of the PHP variable $es - you should be testing against ' $es ' so that PHP is not doing variable substitution within the string. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=403611&aid=577922&group_id=31885 |