From: metamarkers at gmail dot com Operating system: PHP version: Irrelevant Package: Class/Object related Bug Type: Feature/Change Request Bug description:__inClone() magic method to alter an object's inclusion in clones
Description:
------------
It would be nice if an object could determine whether or not it should be
included in a clone, by returning a value that should be used in its stead,
or an
updated clone of itself, or anything of the like.
Test script:
---------------
class Foo { }
class Bar {
public function __inClone ( $clone ) {
return $clone instanceof Foo ? null : $this;
}
}
$foo = new Foo();
$foo->bar = new Bar();
$foo2 = clone $foo;
isset($foo2->bar); // false
--
Edit bug report at https://bugs.php.net/bug.php?id=65718&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=65718&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=65718&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=65718&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=65718&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=65718&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=65718&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=65718&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=65718&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=65718&r=support
Expected behavior: https://bugs.php.net/fix.php?id=65718&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=65718&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=65718&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=65718&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65718&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=65718&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=65718&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=65718&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65718&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=65718&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=65718&r=mysqlcfg
