Home » Internationalization » Translation2 » Bug #3641
Translation2 is not cloneable
Details
| 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) |
Comments
[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 :
http://samalyse.com/ln/t2-clone.diff
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