bug30394.phpt 467 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. Bug #30394 (Assignment operators yield wrong result with __get/__set)
  3. --FILE--
  4. <?php
  5. class Container
  6. {
  7. public function __get( $what )
  8. {
  9. return $this->_p[ $what ];
  10. }
  11. public function __set( $what, $value )
  12. {
  13. $this->_p[ $what ] = $value;
  14. }
  15. private $_p = array();
  16. }
  17. $c = new Container();
  18. $c->a = 1;
  19. $c->a += 1;
  20. print $c->a; // --> 2
  21. print " - ";
  22. $c->a += max( 0, 1 );
  23. print $c->a; // --> 4 (!)
  24. ?>
  25. --EXPECT--
  26. 2 - 3