1--TEST-- 2Inconsistencies when accessing protected members 3--FILE-- 4<?php 5 6class A { 7 static protected function ma() { 8 return 'A::ma()'; 9 } 10 11 static private function mp() { 12 return 'A::mp()'; 13 } 14} 15 16class B1 extends A { 17 static protected function ma() { 18 return 'B1::ma()'; 19 } 20 21 static protected function mp() { 22 return 'B1::mp()'; 23 } 24 25 static protected function mb() { 26 return 'B1::mb()'; 27 } 28} 29 30class B2 extends A { 31 static public function test() { 32 echo A::ma() . "\n"; 33 try { 34 echo A::mp() . "\n"; 35 } catch (\Throwable $e) { 36 echo $e->getMessage() . "\n"; 37 } 38 echo B1::ma() . "\n"; // protected method defined also in A 39 try { 40 echo B1::mp() . "\n"; // protected method defined also in A but as private 41 } catch (\Throwable $e) { 42 echo $e->getMessage() . "\n"; 43 } 44 try { 45 echo B1::mb() . "\n"; 46 } catch (\Throwable $e) { 47 echo $e->getMessage() . "\n"; 48 } 49 } 50} 51 52B2::test(); 53 54?> 55--EXPECT-- 56A::ma() 57Call to private method A::mp() from scope B2 58B1::ma() 59Call to protected method B1::mp() from scope B2 60Call to protected method B1::mb() from scope B2 61