Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.3.1

Bug #17129 Superfluous placeholder replacement
Submitted: 2010-02-18 12:06 UTC
From: gregorycu Assigned: gregorycu
Status: Closed Package: HTML_Template_IT (version 1.3.0a2)
PHP Version: 5.2.5 OS: Windows (Probably others)
Roadmaps: (Not assigned)    
Subscription  


 [2010-02-18 12:06 UTC] gregorycu (Gregory Currie)
Description: ------------ When setting a blocks variables, variables with no placeholder in the current block are used to fill placeholders with the same name in other (non-related) blocks. These other blocks are then parsed when show() is called. Test script: --------------- <!-- BEGIN foo --> My name is {name}. <!-- END foo --> <!-- BEGIN bar --> My age is {age}. <!-- END bar --> <?php require_once('HTML/Template/ITX.php'); $t = new HTML_Template_ITX("."); $t->loadTemplatefile("ttest.html",true,true); $t->setCurrentBlock('foo'); $t->setVariable('name','test_name'); $t->parseCurrentBlock(); $t->setCurrentBlock('bar'); $t->setVariable('name','extra_name'); $t->setVariable('age','23'); $t->parseCurrentBlock(); $t->show(); ?> Expected result: ---------------- My name is test_name. My age is 23. Actual result: -------------- My name is test_name. My name is extra_name. My age is 23.

Comments

 [2010-02-19 00:36 UTC] gregorycu (Gregory Currie)
 [2010-02-21 17:40 UTC] doconnor (Daniel O'Connor)
Hey, thanks for the patch Gregory. Can I get you to do three things first though: 1. Make it against SVN and in universal diff format (svn diff > foo.txt) 2. Make adhere to pear coding style (trivial stuff like function foo($a,$b) {} should be function foo($a, $b) {} 3. Turn your test case below into a test case as part of the patch (see tests/ITXTests.php) You can run the tests from svn via: php tests/AllTests.php
 [2010-02-22 00:31 UTC] gregorycu (Gregory Currie)
 [2010-02-23 16:35 UTC] doconnor (Daniel O'Connor)
Note to self, patch breaks unit tests in current form: 31) testTouchBlockIteration(ITXTest) Undefined variable: blockname /media/disk/pear/packages-all/HTML_Template_IT/HTML/Template/IT.php:1017 /media/disk/pear/packages-all/HTML_Template_IT/HTML/Template/ITX.php:164 /media/disk/pear/packages-all/HTML_Template_IT/HTML/Template/IT.php:900 /media/disk/pear/packages-all/HTML_Template_IT/HTML/Template/IT.php:937 /media/disk/pear/packages-all/HTML_Template_IT/tests/ITTest.php:363 /media/disk/pear/packages-all/HTML_Template_IT/tests/AllTests.php:19 /media/disk/pear/packages-all/HTML_Template_IT/tests/AllTests.php:34 Gregory however is on it :)
 [2010-02-23 16:37 UTC] doconnor (Daniel O'Connor)
-Assigned To: +Assigned To: http://pear.php.
 [2010-02-23 16:37 UTC] doconnor (Daniel O'Connor)
-Assigned To: http://pear.php. +Assigned To: gregorycu
 [2010-02-23 17:46 UTC] gregorycu (Gregory Currie)
 [2010-02-23 20:59 UTC] gregorycu (Gregory Currie)
 [2010-02-23 21:02 UTC] gregorycu (Gregory Currie)
 [2010-02-28 17:37 UTC] gregorycu (Gregory Currie)
Awaiting SVN access, then I'll push a patch to fix this.
 [2010-02-28 18:03 UTC] doconnor (Daniel O'Connor)
-Status: Assigned +Status: Closed
This bug has been fixed in SVN. 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.