Annotation of embedaddon/php/Zend/tests/bug27798.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #27798 (private / protected variables not exposed by get_object_vars() inside class)
                      3: --FILE--
                      4: <?php
                      5: 
                      6: class Base
                      7: {
                      8:        public    $Foo = 1;
                      9:        protected $Bar = 2;
                     10:        private   $Baz = 3;
                     11:        
                     12:        function __construct()
                     13:        {
                     14:                echo __METHOD__ . "\n";
                     15:                var_dump(get_object_vars($this));
                     16:        }
                     17: }
                     18: 
                     19: class Child extends Base
                     20: {
                     21:        private   $Baz = 4;
                     22: 
                     23:        function __construct()
                     24:        {
                     25:                parent::__construct();
                     26:                echo __METHOD__ . "\n";
                     27:                var_dump(get_object_vars($this));
                     28:        }
                     29: }
                     30: 
                     31: var_dump(get_object_vars(new Base));
                     32: var_dump(get_object_vars(new Child));
                     33: 
                     34: ?>
                     35: ===DONE===
                     36: --EXPECT--
                     37: Base::__construct
                     38: array(3) {
                     39:   ["Foo"]=>
                     40:   int(1)
                     41:   ["Bar"]=>
                     42:   int(2)
                     43:   ["Baz"]=>
                     44:   int(3)
                     45: }
                     46: array(1) {
                     47:   ["Foo"]=>
                     48:   int(1)
                     49: }
                     50: Base::__construct
                     51: array(3) {
                     52:   ["Foo"]=>
                     53:   int(1)
                     54:   ["Bar"]=>
                     55:   int(2)
                     56:   ["Baz"]=>
                     57:   int(3)
                     58: }
                     59: Child::__construct
                     60: array(3) {
                     61:   ["Baz"]=>
                     62:   int(4)
                     63:   ["Foo"]=>
                     64:   int(1)
                     65:   ["Bar"]=>
                     66:   int(2)
                     67: }
                     68: array(1) {
                     69:   ["Foo"]=>
                     70:   int(1)
                     71: }
                     72: ===DONE===

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