#26794 [Opn]: $that not available in parent class

From: Date: Mon, 05 Jan 2004 14:20:05 +0000
Subject: #26794 [Opn]: $that not available in parent class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-52813@lists.php.net to get a copy of this message
ID: 26794 User updated by: alex_boyer at hotmail dot com Reported By: alex_boyer at hotmail dot com Status: Open Bug Type: Class/Object related Operating System: windows 2000 PHP Version: 5.0.0b3 (beta3) New Comment: i mean that $that is not available in parent class A (but IT IS available in class B) Previous Comments: ------------------------------------------------------------------------ [2004-01-05 09:17:14] alex_boyer at hotmail dot com 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 this bug report at http://bugs.php.net/?id=26794&edit=1

« previous php.bugs (#52813) next »