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

Bug #14035 flexy:replace, etc. don't handle modifiers
Submitted: 2008-05-31 14:28 UTC
From: ranvis Assigned:
Status: Open Package: HTML_Template_Flexy (version CVS)
PHP Version: Irrelevant OS: Windows
Roadmaps: (Not assigned)    
Subscription  


 [2008-05-31 14:28 UTC] ranvis (Kentaro Sato)
Description: ------------ replaceChildren() used by flexy:replace and flexy:content in the file CustomFlexyAttributes.php doesn't handle values like "object.var" or values with a modifier like ":h" correctly. I've posted this alredy as #14034 but since I attached a patch to the post before confirming my mail address, it seems now impossible to make the report public. BTS complains "Unknown salt"... Test script: --------------- test
test
test Expected result: ---------------- var;?>
options['strict'] || (isset($t) && method_exists($t, 'method'))) echo nl2br(htmlspecialchars($t->method()));?>
object->var);?> Actual result: -------------- plugin("h}",$t->{var);?>
plugin("b}",$t->{method());?>
<?php echo htmlspecialchars($t->{object->var});?>

Comments

 [2008-05-31 15:10 UTC] ranvis (Kentaro Sato)
Hmm, I should have let HTML_Template_Flexy_Token_Method::setValue() to parse method arguments and modifiers?
 [2008-05-31 17:47 UTC] ranvis (Kentaro Sato)
Here's the mutex patch that parses method inside setValue().
 [2009-02-28 19:55 UTC] ranvis (Kentaro Sato)
The patches had problem handling "method(#with colon: inside#)". Below is the fix for replacechildren-another.diff in case someone else is using it :) PATCH: --- pear/HTML/Template/Flexy/Token/Method.php +++ pear/HTML/Template/Flexy/Token/Method.php @@ -70,7 +70,8 @@ if (!is_array($value)) { $value = $this->parseAndSetIf($value); $modifier = strrpos($value,':'); - if ($modifier !== false) { + $parenClose = strrpos($value,')'); + if ($modifier !== false && ($parenClose === false || $parenClose < $modifier)) { $this->modifier = substr($value,$modifier+1); $value = substr($value,0,$modifier); } else TEST:
EXPECTED:
options['strict'] || (isset($t) && method_exists($t, 'method'))) echo htmlspecialchars($t->method("1:23:45"));?>
options['strict'] || (isset($t) && method_exists($t, 'method'))) echo $t->method("1:23:45");?>
ACTUAL:
options['strict'] || (isset($t) && method_exists($t, 'method'))) echo $this->plugin("45#)",$t->method("1:"));?>
options['strict'] || (isset($t) && method_exists($t, 'method'))) echo $t->method("1:23:45");?>