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

Bug #5539 DefaultText decorator does not call _replaceParams
Submitted: 2005-09-27 20:50 UTC
From: jrossiter at pheedo dot com Assigned: quipo
Status: Closed Package: Translation2
PHP Version: Irrelevant OS: Linux RHEL3
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 4 - 1 = ?

 
 [2005-09-27 20:50 UTC] jrossiter at pheedo dot com
Description: ------------ The DefaultText decorator does not call _replaceParams on the string before returning it to the user. Test script: --------------- (Extraneous details such as language left out) $tr = Translation2::factory($driver, $dbinfo, $params); $tr =& $tr->getDecorator('DefaultText'); $tr->setParams(array('foo' => 'bar')); $output = $tr->get('String &&foo&& not in DB'); Fix: Simply wrap the return for Translation2_Decorator_DefaultText::get() with $this->_replaceParams() =================================================================== --- Translation2/Decorator/DefaultText.php +++ Translation2/Decorator/DefaultText.php @@ -125,7 +125,7 @@ urlencode($pageID), $this->url ); - return $this->emptyPrefix.str_replace($search, $replace, $this->outputString).$this->emptyPostfix; + return $this->_replaceParams($this->emptyPrefix.str_replace($search, $replace, $this->outputString).$this->emptyPostfix); //$str = (empty($defaultText) ? $this->emptyPrefix.$stringID.$this->emptyPostfix : $defaultText); } Expected result: ---------------- Output should be "String bar not in DB" Actual result: -------------- Actual output is "String &&foo&& not in DB"

Comments

 [2005-09-27 20:56 UTC] jrossiter at pheedo dot com
This also needs to occur for the defaultText condition inside Translation2_Decorator_DefaultText::get(). if (!empty($defaultText)) { return $defaultText; } should be if (!empty($defaultText)) { return $this->_replaceParams($defaultText); }
 [2006-12-06 11:42 UTC] quipo (Lorenzo Alberton)
This bug has been fixed in CVS. 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.