ID:               27074
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Closed
 Bug Type:         Zend Engine 2 problem
 Operating System: linux
 PHP Version:      5CVS-2004-01-28 (dev)
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Check bug report http://bugs.php.net/?id=26794
We rewrote the __clone() support. If you still have this problem then
please reopen the bug report


Previous Comments:
------------------------------------------------------------------------

[2004-01-28 08:55:27] [EMAIL PROTECTED]

Description:
------------
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
difference between the expected and the actual result is the second
call to print_r()

Reproduce code:
---------------
<?php
class clone_example {
        private $pub = 2;
        private $obj = NULL;

        function clone_example($obj) {
                $this->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();
?>

Expected result:
----------------
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] => fubar Object
        (
            [v] => Array
                (
                    [0] => 1
                    [1] => 2
                    [2] => 3
                )

        )

)
clone_example Object
(
    [pub:private] => 2
    [obj:private] => fubar Object
        (
            [v] => Array
                (
                    [0] => 1
                    [1] => 2
                    [2] => 3
                )

        )

)

Actual result:
--------------
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
                )

        )

)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27074&edit=1

Reply via email to