blob: 9a251c506f4ee2230e7ee3fb73b0e099dbf7a7b0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
--TEST--
ZE2 object cloning, 3
--SKIPIF--
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
--FILE--
<?php
class base {
protected $p1 = 'base:1';
public $p2 = 'base:2';
public $p3 = 'base:3';
public $p4 = 'base:4';
public $p5 = 'base:5';
private $p6 = 'base:6';
public function __clone() {
}
};
class test extends base {
public $p1 = 'test:1';
public $p3 = 'test:3';
public $p4 = 'test:4';
public $p5 = 'test:5';
public function __clone() {
$this->p5 = 'clone:5';
}
}
$obj = new test;
$obj->p4 = 'A';
$copy = clone $obj;
echo "Object\n";
print_r($obj);
echo "Clown\n";
print_r($copy);
echo "Done\n";
?>
--EXPECT--
Object
test Object
(
[p1] => test:1
[p3] => test:3
[p4] => A
[p5] => test:5
[p2] => base:2
[p6:base:private] => base:6
)
Clown
test Object
(
[p1] => test:1
[p3] => test:3
[p4] => A
[p5] => clone:5
[p2] => base:2
[p6:base:private] => base:6
)
Done
|