File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug30889.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:52 2012 UTC (13 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

    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>