xref: /PHP-5.3/Zend/tests/bug44899_2.phpt (revision a578b0cb)
1--TEST--
2Bug #44899 (__isset usage changes behavior of empty()) - 2
3--FILE--
4<?php
5
6class myclass
7{
8	private $_data = array();
9
10	function __construct($data)
11	{
12		$this->_data = $data;
13	}
14
15	function __isset($field_name)
16	{
17		return isset($this->_data[$field_name]);
18	}
19
20	function __get($var) {
21		var_dump(empty($this->_data[$var]));
22		return $this->_data[$var];
23	}
24}
25
26$arr = array('foo' => '');
27
28$myclass = new myclass($arr) ;
29
30echo (isset($myclass->foo)) ? 'isset' : 'not isset';
31echo "\n";
32echo (empty($myclass->foo)) ? 'empty' : 'not empty';
33echo "\n";
34echo ($myclass->foo) ? 'not empty' : 'empty';
35echo "\n";
36
37?>
38--EXPECT--
39isset
40bool(true)
41empty
42bool(true)
43empty
44