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