Annotation of embedaddon/php/ext/reflection/tests/ReflectionProperty_constructor_variation1.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: ReflectionProperty::__construct(): ensure inherited private props can't be accessed through ReflectionProperty.
                      3: --FILE--
                      4: <?php
                      5: 
                      6: class C {
                      7:        private $p = 1;
                      8:        
                      9:        static function testFromC() {
                     10:                try {
                     11:                  $rp = new ReflectionProperty("D", "p");
                     12:                  var_dump($rp);
                     13:                } catch (Exception $e) {
                     14:                        echo $e->getMessage();
                     15:                }               
                     16:        }
                     17: }
                     18: 
                     19: class D extends C{
                     20:        static function testFromD() {
                     21:                try {
                     22:                  $rp = new ReflectionProperty("D", "p");
                     23:                  var_dump($rp);
                     24:                } catch (Exception $e) {
                     25:                        echo $e->getMessage();
                     26:                }               
                     27:        }
                     28: }
                     29: 
                     30: echo "--> Reflect inherited private from global scope:\n";
                     31: try {
                     32:   $rp = new ReflectionProperty("D", "p");
                     33:   var_dump($rp);
                     34: } catch (Exception $e) {
                     35:        echo $e->getMessage();
                     36: }
                     37: 
                     38: echo "\n\n--> Reflect inherited private from declaring scope:\n";
                     39: C::testFromC();
                     40: 
                     41: echo "\n\n--> Reflect inherited private from declaring scope via subclass:\n";
                     42: D::testFromC();
                     43: 
                     44: echo "\n\n--> Reflect inherited private from subclass:\n";
                     45: D::testFromD();
                     46: ?>
                     47: --EXPECTF--
                     48: --> Reflect inherited private from global scope:
                     49: Property D::$p does not exist
                     50: 
                     51: --> Reflect inherited private from declaring scope:
                     52: Property D::$p does not exist
                     53: 
                     54: --> Reflect inherited private from declaring scope via subclass:
                     55: Property D::$p does not exist
                     56: 
                     57: --> Reflect inherited private from subclass:
                     58: Property D::$p does not exist

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