xref: /PHP-7.1/tests/classes/clone_002.phpt (revision 610c7fbe)
1--TEST--
2ZE2 object cloning, 2
3--SKIPIF--
4<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
5--FILE--
6<?php
7class test {
8	public $p1 = 1;
9	public $p2 = 2;
10	public $p3;
11	public function __clone() {
12	}
13};
14
15$obj = new test;
16$obj->p2 = 'A';
17$obj->p3 = 'B';
18$copy = clone $obj;
19$copy->p3 = 'C';
20echo "Object\n";
21var_dump($obj);
22echo "Clown\n";
23var_dump($copy);
24echo "Done\n";
25?>
26--EXPECT--
27Object
28object(test)#1 (3) {
29  ["p1"]=>
30  int(1)
31  ["p2"]=>
32  string(1) "A"
33  ["p3"]=>
34  string(1) "B"
35}
36Clown
37object(test)#2 (3) {
38  ["p1"]=>
39  int(1)
40  ["p2"]=>
41  string(1) "A"
42  ["p3"]=>
43  string(1) "C"
44}
45Done
46