1--TEST-- 2Bug #49719 (ReflectionClass::hasProperty returns true for a private property in base class) 3--FILE-- 4<?php 5 6class A { 7 private $a; 8} 9class B extends A { 10 private $b; 11} 12 13try { 14 $b = new B; 15 $ref = new ReflectionClass($b); 16 17 var_dump(property_exists('b', 'a')); 18 var_dump(property_exists($b, 'a')); 19 var_dump($ref->hasProperty('a')); 20 var_dump($ref->getProperty('a')); 21} catch (Exception $e) { 22 var_dump($e->getMessage()); 23} 24 25class A2 { 26 private $a = 1; 27} 28 29class B2 extends A2 { 30 private $a = 2; 31} 32 33$b2 = new ReflectionClass('B2'); 34$prop = $b2->getProperty('a'); 35var_dump($prop->getValue(new b2)); 36 37?> 38--EXPECT-- 39bool(false) 40bool(false) 41bool(false) 42string(29) "Property B::$a does not exist" 43int(2) 44