xref: /PHP-5.6/Zend/tests/bug44899.phpt (revision a578b0cb)
1--TEST--
2Bug #44899 (__isset usage changes behavior of empty())
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
21$arr = array('foo' => '');
22
23$myclass = new myclass($arr) ;
24
25echo (isset($myclass->foo)) ? 'isset' : 'not isset';
26echo "\n";
27echo (empty($myclass->foo)) ? 'empty' : 'not empty';
28echo "\n";
29echo ($myclass->foo) ? 'not empty' : 'empty';
30echo "\n";
31
32?>
33--EXPECTF--
34isset
35empty
36
37Notice: Undefined property: myclass::$foo in %s on line %d
38empty
39