2003-07-02 05:27:59 +08:00
|
|
|
--TEST--
|
|
|
|
ZE2 object cloning, 1
|
|
|
|
--SKIPIF--
|
|
|
|
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
class test {
|
|
|
|
public $p1 = 1;
|
|
|
|
public $p2 = 2;
|
|
|
|
public $p3;
|
|
|
|
};
|
|
|
|
|
|
|
|
$obj = new test;
|
|
|
|
$obj->p2 = 'A';
|
|
|
|
$obj->p3 = 'B';
|
2004-02-04 05:52:46 +08:00
|
|
|
$copy = clone $obj;
|
2003-07-02 05:27:59 +08:00
|
|
|
$copy->p3 = 'C';
|
|
|
|
echo "Object\n";
|
|
|
|
var_dump($obj);
|
|
|
|
echo "Clown\n";
|
|
|
|
var_dump($copy);
|
|
|
|
echo "Done\n";
|
|
|
|
?>
|
|
|
|
--EXPECT--
|
|
|
|
Object
|
|
|
|
object(test)#1 (3) {
|
|
|
|
["p1"]=>
|
|
|
|
int(1)
|
|
|
|
["p2"]=>
|
|
|
|
string(1) "A"
|
|
|
|
["p3"]=>
|
|
|
|
string(1) "B"
|
|
|
|
}
|
|
|
|
Clown
|
|
|
|
object(test)#2 (3) {
|
|
|
|
["p1"]=>
|
|
|
|
int(1)
|
|
|
|
["p2"]=>
|
|
|
|
string(1) "A"
|
|
|
|
["p3"]=>
|
|
|
|
string(1) "C"
|
|
|
|
}
|
|
|
|
Done
|