Annotation of embedaddon/php/ext/spl/tests/bug45614.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: SPL: Bug#45614 (ArrayIterator can show 1st private prop of wrapped object)
        !             3: --FILE--
        !             4: <?php
        !             5: class C {
        !             6:        private $priv1 = 'secret1';
        !             7:        private $priv2 = 'secret2';
        !             8:        public $pub1 = 'public1';
        !             9:        public $pub2 = 'public2';
        !            10:        public $pub3 = 'public3';
        !            11: } 
        !            12: 
        !            13: function showFirstTwoItems($it) {
        !            14:   echo str_replace("\0", '\0', $it->key()) . " => " . $it->current() .
        !            15: "\n";
        !            16:   $it->next();
        !            17:   echo str_replace("\0", '\0', $it->key()) . " => " . $it->current() .
        !            18: "\n";
        !            19: }
        !            20: 
        !            21: $ao = new ArrayObject(new C);
        !            22: $ai = $ao->getIterator();
        !            23: 
        !            24: echo "--> Show the first two items:\n";
        !            25: showFirstTwoItems($ai);
        !            26: 
        !            27: echo "\n--> Rewind and show the first two items:\n";
        !            28: $ai->rewind();
        !            29: showFirstTwoItems($ai);
        !            30: 
        !            31: echo "\n--> Invalidate current position and show the first two items:\n";
        !            32: unset($ai[$ai->key()]);
        !            33: $ai->current();
        !            34: showFirstTwoItems($ai);
        !            35: 
        !            36: echo "\n--> Rewind, seek and show the first two items:\n";
        !            37: $ai->rewind();
        !            38: $ai->seek(0);
        !            39: showFirstTwoItems($ai);
        !            40: ?>
        !            41: --EXPECT--
        !            42: --> Show the first two items:
        !            43: pub1 => public1
        !            44: pub2 => public2
        !            45: 
        !            46: --> Rewind and show the first two items:
        !            47: pub1 => public1
        !            48: pub2 => public2
        !            49: 
        !            50: --> Invalidate current position and show the first two items:
        !            51: pub1 => public1
        !            52: pub3 => public3
        !            53: 
        !            54: --> Rewind, seek and show the first two items:
        !            55: pub1 => public1
        !            56: pub3 => public3

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