1--TEST-- 2ZE2 A private member is 3--SKIPIF-- 4<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> 5--FILE-- 6<?php 7 8class base 9{ 10 private $member; 11 12 function __construct() 13 { 14 echo __METHOD__ . "(begin)\n"; 15 $this->member = 'base::member'; 16 $this->test(); 17 echo __METHOD__ . "(end)\n"; 18 } 19 20 function test() 21 { 22 echo __METHOD__ . "\n"; 23 print_r($this); 24 } 25} 26 27class derived extends base 28{ 29 public $member = 'derived::member (default)'; 30 31 function __construct() 32 { 33 echo __METHOD__ . "(begin)\n"; 34 parent::__construct(); 35 parent::test(); 36 $this->test(); 37 $this->member = 'derived::member'; 38 echo __METHOD__ . "(end)\n"; 39 } 40 41 function test() 42 { 43 parent::test(); 44 echo __METHOD__ . "\n"; 45 print_r($this); 46 } 47} 48 49$t = new derived; 50$t->test(); 51unset($t); 52 53echo "Done\n"; 54 55?> 56--EXPECTF-- 57derived::__construct(begin) 58base::__construct(begin) 59base::test 60derived Object 61( 62 [member] => derived::member (default) 63 [member:base:private] => base::member 64) 65derived::test 66derived Object 67( 68 [member] => derived::member (default) 69 [member:base:private] => base::member 70) 71base::__construct(end) 72base::test 73derived Object 74( 75 [member] => derived::member (default) 76 [member:base:private] => base::member 77) 78base::test 79derived Object 80( 81 [member] => derived::member (default) 82 [member:base:private] => base::member 83) 84derived::test 85derived Object 86( 87 [member] => derived::member (default) 88 [member:base:private] => base::member 89) 90derived::__construct(end) 91base::test 92derived Object 93( 94 [member] => derived::member 95 [member:base:private] => base::member 96) 97derived::test 98derived Object 99( 100 [member] => derived::member 101 [member:base:private] => base::member 102) 103Done 104