File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug37667.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 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

--TEST--
Bug #37667 (Object is not added into array returned by __get)
--FILE--
<?php

class Test
{
	protected $property = array('foo' => 'bar');

	function __get($name)
	{
		return $this->property;
	}
}

$obj = new Test;

var_dump($obj->property['foo']);
var_dump($obj->property[2]);

var_dump($obj);

$obj->property[] = 1;
$obj->property[] = 2;

var_dump($obj);

?>
===DONE===
--EXPECTF--
string(3) "bar"

Notice: Undefined offset: 2 in %sbug37667.php on line 16
NULL
object(Test)#%d (1) {
  ["property":protected]=>
  array(1) {
    ["foo"]=>
    string(3) "bar"
  }
}

Notice: Indirect modification of overloaded property Test::$property has no effect in %sbug37667.php on line 20

Notice: Indirect modification of overloaded property Test::$property has no effect in %sbug37667.php on line 21
object(Test)#%d (1) {
  ["property":protected]=>
  array(1) {
    ["foo"]=>
    string(3) "bar"
  }
}
===DONE===

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