Annotation of embedaddon/php/Zend/tests/bug44899_2.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #44899 (__isset usage changes behavior of empty()) - 2
! 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: 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:
! 30: echo (isset($myclass->foo)) ? 'isset' : 'not isset';
! 31: echo "\n";
! 32: echo (empty($myclass->foo)) ? 'empty' : 'not empty';
! 33: echo "\n";
! 34: echo ($myclass->foo) ? 'not empty' : 'empty';
! 35: echo "\n";
! 36:
! 37: ?>
! 38: --EXPECT--
! 39: isset
! 40: bool(true)
! 41: empty
! 42: bool(true)
! 43: empty
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>