Annotation of embedaddon/php/ext/reflection/tests/bug49719.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Bug #49719 (ReflectionClass::hasProperty returns true for a private property in base class)
        !             3: --FILE--
        !             4: <?php
        !             5: 
        !             6: class A {
        !             7:        private $a;
        !             8: }
        !             9: class B extends A {
        !            10:        private $b;
        !            11: }
        !            12: 
        !            13: try {
        !            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: 
        !            25: class A2 {
        !            26:        private $a = 1;
        !            27: }
        !            28: 
        !            29: class B2 extends A2 {
        !            30:        private $a = 2;
        !            31: }
        !            32: 
        !            33: $b2 = new ReflectionClass('B2');
        !            34: $prop = $b2->getProperty('a');
        !            35: $prop->setAccessible(true);
        !            36: var_dump($prop->getValue(new b2));
        !            37: 
        !            38: ?>
        !            39: --EXPECTF--
        !            40: bool(false)
        !            41: bool(false)
        !            42: bool(false)
        !            43: %string|unicode%(25) "Property a does not exist"
        !            44: int(2)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>