]> granicus.if.org Git - php/commitdiff
Added test for 5.0 specific bug #30394 (Assignment operators yield wrong result with...
authorDmitry Stogov <dmitry@php.net>
Fri, 3 Jun 2005 15:38:32 +0000 (15:38 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 3 Jun 2005 15:38:32 +0000 (15:38 +0000)
Zend/tests/bug30394.phpt [new file with mode: 0755]

diff --git a/Zend/tests/bug30394.phpt b/Zend/tests/bug30394.phpt
new file mode 100755 (executable)
index 0000000..b69eda4
--- /dev/null
@@ -0,0 +1,30 @@
+--TEST--
+Bug #30394 (Assignment operators yield wrong result with __get/__set)
+--FILE--
+<?php
+class Container
+{
+       public function __get( $what )
+       {
+               return $this->_p[ $what ];
+       }
+       
+       public function __set( $what, $value )
+       {
+               $this->_p[ $what ] = $value;
+       }
+       
+       private $_p = array();
+}
+
+$c = new Container();
+$c->a = 1;
+$c->a += 1;
+print $c->a;   // --> 2
+
+print " - ";
+$c->a += max( 0, 1 );
+print $c->a;   // --> 4 (!)
+?>
+--EXPECT--
+2 - 3