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  


 [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] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!