1--TEST-- 2Overriding private hooks 3--FILE-- 4<?php 5 6class A { 7 private $prop1; 8 private $prop2 { 9 get { echo __METHOD__, "\n"; } 10 set { echo __METHOD__, "\n"; } 11 } 12 13 public function testPrivate() { 14 $this->prop1; 15 $this->prop1 = 1; 16 $this->prop2; 17 $this->prop2 = 1; 18 } 19} 20 21class B extends A { 22 public $prop1 { 23 get { echo __METHOD__, "\n"; } 24 set { echo __METHOD__, "\n"; } 25 } 26 public $prop2 { 27 get { echo __METHOD__, "\n"; } 28 set { echo __METHOD__, "\n"; } 29 } 30} 31 32$a = new A; 33$a->testPrivate(); 34echo "\n"; 35 36$b = new B; 37$b->testPrivate(); 38echo "\n"; 39 40$b->prop1; 41$b->prop1 = 1; 42$b->prop2; 43$b->prop2 = 1; 44 45?> 46--EXPECT-- 47A::$prop2::get 48A::$prop2::set 49 50A::$prop2::get 51A::$prop2::set 52 53B::$prop1::get 54B::$prop1::set 55B::$prop2::get 56B::$prop2::set 57