#26794 [NEW]: $that not available in parent class
| From: | alex_boyer at hotmail dot com | Date: | Mon, 05 Jan 2004 14:17:14 +0000 |
| Subject: | #26794 [NEW]: $that not available in parent class | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-52812@lists.php.net to get a copy of this message | ||
From: alex_boyer at hotmail dot com
Operating system: windows 2000
PHP version: 5.0.0b3 (beta3)
PHP Bug Type: Class/Object related
Bug description: $that not available in parent class
Description:
------------
$that is not available in parent class B (uncomment code in class A you
will see it). So it is not possible to clone class in a recursive way.
Reproduce code:
---------------
class A {
public $a;
function __clone(){
//if( $that === null ) die('$that is null');
$this->a = $that->a;
}
}
class B extends A {
public $b;
function __clone(){
parent::__clone();
$this->b = $that->b;
}
}
$b = new B();
$b->a = 'AAA';
$b->b = 'BBB';
$clone = $b->__clone();
print_r($clone);
Expected result:
----------------
B Object
(
[b] => BBB
[a] => AAA
)
Actual result:
--------------
B Object
(
[b] => BBB
[a] =>
)
--
Edit bug report at http://bugs.php.net/?id=26794&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26794&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26794&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26794&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26794&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26794&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26794&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26794&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26794&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26794&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26794&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26794&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26794&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26794&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26794&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26794&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26794&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26794&r=float