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

Bug #3641 Translation2 is not cloneable
Submitted: 2005-02-28 18:36 UTC
From: ojai at nerim dot net Assigned: quipo
Status: Closed Package: Translation2
PHP Version: 5.0.2 OS: Linux Debian
Roadmaps: (Not assigned)    

 [2005-02-28 18:36 UTC] ojai at nerim dot net
Description: ------------ Translation2 version : current CVS Translation2 doesn't make use of a __clone() method to clone its internal object references. Here's a patch that corrects this issue : I think you should add a __clone() method to the Decorator as well. Reproduce code: --------------- require_once 'PEAR.php'; require_once 'Translation2.php'; $t2 =& Translation2::factory ('XML', array('filename' => 'i18n.xml')); $t2->setLang ('en'); $t2_clone = clone ($t2); $t2_clone->setLang('fr'); // This shouldn't change $t2 echo $t2->get('invoice','documents'); // But it does... Expected result: ---------------- Invoice Actual result: -------------- Facture


 [2005-03-03 16:37 UTC] quipo
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on In case this was a website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. -- patch applied, many thanks. I also added it to Translation2_Decorator, is it working as expected?