Annotation of embedaddon/php/tests/classes/bug63462.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test script to verify that magic methods should be called only once when accessing an unset property.
        !             3: --CREDITS--
        !             4: Marco Pivetta <ocramius@gmail.com>
        !             5: --XFAIL--
        !             6: Bug 63462 is not yet fixed
        !             7: --FILE--
        !             8: <?php
        !             9: class Test {
        !            10:        public    $publicProperty;
        !            11:        protected $protectedProperty;
        !            12:        private   $privateProperty;
        !            13: 
        !            14:        public function __construct() {
        !            15:                unset(
        !            16:                        $this->publicProperty,
        !            17:                        $this->protectedProperty,
        !            18:                        $this->privateProperty
        !            19:                );
        !            20:        }
        !            21: 
        !            22:        function __get($name) {
        !            23:                echo '__get ' . $name . "\n";
        !            24:                return $this->$name;
        !            25:        }
        !            26: 
        !            27:        function __set($name, $value) {
        !            28:                echo '__set ' . $name . "\n";
        !            29:                $this->$name = $value;
        !            30:        }
        !            31: 
        !            32:        function __isset($name) {
        !            33:                echo '__isset ' . $name . "\n";
        !            34:                return isset($this->$name);
        !            35:        }
        !            36: }
        !            37: 
        !            38: $test = new Test();
        !            39: 
        !            40: $test->nonExisting;
        !            41: $test->publicProperty;
        !            42: $test->protectedProperty;
        !            43: $test->privateProperty;
        !            44: isset($test->nonExisting);
        !            45: isset($test->publicProperty);
        !            46: isset($test->protectedProperty);
        !            47: isset($test->privateProperty);
        !            48: $test->nonExisting       = 'value';
        !            49: $test->publicProperty   = 'value';
        !            50: $test->protectedProperty = 'value';
        !            51: $test->privateProperty   = 'value';
        !            52: 
        !            53: ?>
        !            54: 
        !            55: --EXPECTF--
        !            56: __get nonExisting
        !            57: Notice: Undefined index: nonExisting in %__set__get_006.php on line %d
        !            58: __get publicProperty
        !            59: Notice: Undefined index: publicProperty in %__set__get_006.php on line %d
        !            60: __get protectedProperty
        !            61: Notice: Undefined index: protectedProperty in %__set__get_006.php on line %d
        !            62: __get privateProperty
        !            63: Notice: Undefined index: privateProperty in %__set__get_006.php on line %d
        !            64: __isset nonExisting
        !            65: __isset publicProperty
        !            66: __isset protectedProperty
        !            67: __isset privateProperty
        !            68: __set nonExisting
        !            69: __set publicProperty
        !            70: __set protectedProperty
        !            71: __set privateProperty

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