Annotation of embedaddon/php/Zend/tests/bug44899.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #44899 (__isset usage changes behavior of empty())
3: --FILE--
4: <?php
5:
6: class 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:
25: echo (isset($myclass->foo)) ? 'isset' : 'not isset';
26: echo "\n";
27: echo (empty($myclass->foo)) ? 'empty' : 'not empty';
28: echo "\n";
29: echo ($myclass->foo) ? 'not empty' : 'empty';
30: echo "\n";
31:
32: ?>
33: --EXPECTF--
34: isset
35: empty
36:
37: Notice: Undefined property: myclass::$foo in %s on line %d
38: empty
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>