Annotation of embedaddon/php/Zend/tests/bug30889.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Bug #30889 (Conflict between __get/__set and ++ operator)
        !             3: --FILE--
        !             4: <?php
        !             5: class overloaded
        !             6: {
        !             7:   private $values;
        !             8:   function __construct()
        !             9:   {
        !            10:     $this->values = array('a' => 0);
        !            11:   }
        !            12:   function __set($name, $value)
        !            13:   {
        !            14:     print "set $name = $value ($name was ".$this->values[$name].")\n";
        !            15:     $this->values[$name] = $value;
        !            16:   }
        !            17:   function __get($name)
        !            18:   {
        !            19:     print "get $name (returns ".$this->values[$name].")\n";
        !            20:     return $this->values[$name];
        !            21:   }
        !            22: }
        !            23: $test = new overloaded();
        !            24: $test->a++;     // __get(), then __set()
        !            25: ++$test->a;
        !            26: ?>
        !            27: --EXPECT--
        !            28: get a (returns 0)
        !            29: set a = 1 (a was 0)
        !            30: get a (returns 1)
        !            31: set a = 2 (a was 1)

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