Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7373 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51082 invoked by uid 1010); 28 Jan 2004 13:16:35 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 51056 invoked from network); 28 Jan 2004 13:16:35 -0000 Received: from unknown (HELO stella.fastforwardnetwork.com) (209.51.153.50) by pb1.pair.com with SMTP; 28 Jan 2004 13:16:35 -0000 Received: (qmail 4674 invoked by uid 2526); 28 Jan 2004 14:22:12 -0000 Received: from 212.9.189.193 ( [212.9.189.193]) as user php@localhost by webmail.hristov.com with HTTP; Wed, 28 Jan 2004 09:22:12 -0500 Message-ID: <1075299732.4017c594b8b7f@webmail.hristov.com> Date: Wed, 28 Jan 2004 09:22:12 -0500 To: internals@lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.1 X-Originating-IP: 212.9.189.193 Subject: __clone() has problem with the vision. maybe needs glasses? :) From: php@hristov.com (Andrey Hristov) Hi internals, in the following code __clone() have problems with member variables of type object ($this->obj is null). If the comment is removed from the call to __clone2() in __clone() then __clone2() also has problems with the vision. On the other hand __clone2() has no problems when called externally. The code : obj = $obj; } function __clone() { print_r($this); // $this->__clone2(); } function __clone2() { print_r($this); } } class fubar { public $v = array(1,2,3); } $fu = new fubar(); $a = new clone_example($fu); $a->__clone2(); $a->__clone(); $a->__clone2(); ?> The output is : clone_example Object ( [pub:private] => 2 [obj:private] => fubar Object ( [v] => Array ( [0] => 1 [1] => 2 [2] => 3 ) ) ) clone_example Object ( [pub:private] => 2 [obj:private] => ) clone_example Object ( [pub:private] => 2 [obj:private] => fubar Object ( [v] => Array ( [0] => 1 [1] => 2 [2] => 3 ) ) ) Am I doing something wrong or there is something wrong in the engine? Andrey