?? Jan 2007, PHP 5.2.1RC3
- Improved proc_open(). Now on Windows it can run external commands not through
CMD.EXE. (Dmitry)
+- Fixed bug #40036 (empty() does not work correctly with ArrayObject when using
+ ARRAY_AS_PROPS). (Ilia)
- Fixed bug #39504 (xmlwriter_write_dtd_entity() creates Attlist tag,
not entity). (Hannes)
switch(Z_TYPE_P(offset)) {
case IS_STRING:
- return zend_symtable_exists(spl_array_get_hash_table(intern, 0 TSRMLS_CC), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
+ if (check_empty) {
+ zval **tmp;
+ HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
+ if (zend_hash_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &tmp) != FAILURE && zend_is_true(*tmp)) {
+ return 1;
+ }
+ return 0;
+ } else {
+ return zend_symtable_exists(spl_array_get_hash_table(intern, 0 TSRMLS_CC), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
+ }
case IS_DOUBLE:
case IS_RESOURCE:
case IS_BOOL:
} else {
index = Z_LVAL_P(offset);
}
- return zend_hash_index_exists(spl_array_get_hash_table(intern, 0 TSRMLS_CC), index);
+ if (check_empty) {
+ zval **tmp;
+ HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
+ if (zend_hash_index_find(ht, index, (void **)&tmp) != FAILURE && zend_is_true(*tmp)) {
+ return 1;
+ }
+ return 0;
+ } else {
+ return zend_hash_index_exists(spl_array_get_hash_table(intern, 0 TSRMLS_CC), index);
+ }
default:
zend_error(E_WARNING, "Illegal offset type");
}
--- /dev/null
+--TEST--
+Bug #40036 (empty() does not work correctly with ArrayObject when using ARRAY_AS_PROPS)
+--SKIPIF--
+<?php if (!extension_loaded("spl")) print "skip"; ?>
+--FILE--
+<?php
+class View extends ArrayObject
+{
+ public function __construct(array $array = array())
+ {
+ parent::__construct($array, ArrayObject::ARRAY_AS_PROPS);
+ }
+}
+
+$view = new View();
+$view->foo = false;
+$view->bar = null;
+$view->baz = '';
+if (empty($view['foo']) || empty($view->foo)) {
+ echo "View::foo empty\n";
+}
+if (empty($view['bar']) || empty($view->bar)) {
+ echo "View::bar empty\n";
+}
+if (empty($view['baz']) || empty($view->baz)) {
+ echo "View::baz empty\n";
+}
+?>
+===DONE===
+--EXPECT--
+View::foo empty
+View::bar empty
+View::baz empty
+===DONE===