PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Internationalization » Translation2 » Bug #3641

Translation2 is not cloneable

Details

Submitted2005-02-28 18:36 UTC
Fromojai at nerim dot net
Assignedquipo
StatusClosed
PackageTranslation2
PHP Version5.0.2
OSLinux 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