summaryrefslogtreecommitdiff
path: root/Zend/tests/objects_024.phpt
blob: cbdb1cc2026f247f0457b97d07e3824f4bbd88be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--TEST--
Testing direct assigning for property of object returned by function
--FILE--
<?php

class foo {
	static $bar = array();

	public function __set($a, $b) {
		self::$bar[] = $b;
	}

	public function __get($a) {
		/* last */
		return self::$bar[count(self::$bar)-1];
	}
}

function test() {
	return new foo;
}

$a = test()->bar = 1;
var_dump($a, count(foo::$bar), test()->whatever);

print "\n";

$a = test()->bar = NULL;
var_dump($a, count(foo::$bar), test()->whatever);

print "\n";

$a = test()->bar = test();
var_dump($a, count(foo::$bar), test()->whatever);

print "\n";

?>
--EXPECTF--
int(1)
int(1)
int(1)

NULL
int(2)
NULL

object(foo)#%d (0) {
}
int(3)
object(foo)#%d (0) {
}