# Pb __clone method crash

- Thread: https://externals.io/message/123
- Original archive: https://news-web.php.net/php.internals/123
- Started by Fabrice Le Coz on 2003-03-20T09:52:36+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #123 — Fabrice Le Coz — 2003-03-20T09:52:36+00:00

URL: https://externals.io/message/123#123

Hi,

return of the __clone() method crash.

<?php
class test {
    var $name;
    
    function __construct($name) {
        $this->name = $name;
    }
    
    function __clone() {
        echo "cloning ...\n";
        $this->name = "test ".$that->name;
    }
}

$test = new test("essai");
$test1 = $test;
$test2 = $test->__clone();
$test1->name = "arthur";
echo "test  : $test->name\n";
echo "test2 : $test2->name\n";
?>

-- expect --
cloning ...
test  : arthur
test2 : test essai

-- result --
cloning ...

php crash
AppName: php.exe AppVer: 5.0.0.0 ModName: php4ts.dll ModVer: 5.0.0.0 
Offset: 000ee8a5
