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