helly Mon Nov 17 00:25:48 2003 EDT
Modified files:
/spl spl_array.c
Log:
Fix ArrayClass and provide missing has_dimension handler.
Index: spl/spl_array.c
diff -u spl/spl_array.c:1.22 spl/spl_array.c:1.23
--- spl/spl_array.c:1.22 Sun Nov 9 09:05:34 2003
+++ spl/spl_array.c Mon Nov 17 00:25:47 2003
@@ -106,10 +106,7 @@
zend_hash_destroy(intern->std.properties);
FREE_HASHTABLE(intern->std.properties);
- if (!ZVAL_DELREF(intern->array)) {
- zval_dtor(intern->array);
- FREE_ZVAL(intern->array);
- }
+ zval_ptr_dtor(&intern->array);
efree(object);
}
@@ -275,6 +272,32 @@
}
/* }}} */
+/* {{{ spl_array_has_dimension */
+static int spl_array_has_dimension(zval *object, zval *offset, int check_empty
TSRMLS_DC)
+{
+ spl_array_object *intern =
(spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
+ long index;
+
+ switch(Z_TYPE_P(offset)) {
+ case IS_STRING:
+ return zend_symtable_exists(HASH_OF(intern->array),
Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
+ case IS_DOUBLE:
+ case IS_RESOURCE:
+ case IS_BOOL:
+ case IS_LONG:
+ if (offset->type == IS_DOUBLE) {
+ index = (long)Z_DVAL_P(offset);
+ } else {
+ index = Z_LVAL_P(offset);
+ }
+ return zend_hash_index_exists(HASH_OF(intern->array), index);
+ default:
+ zend_error(E_WARNING, "Illegal offset type");
+ }
+ return 0;
+}
+/* }}} */
+
/* {{{ spl_array_get_properties */
static HashTable *spl_array_get_properties(zval *object TSRMLS_DC)
{
@@ -299,6 +322,7 @@
spl_handler_ArrayClass.read_dimension = spl_array_read_dimension;
spl_handler_ArrayClass.write_dimension = spl_array_write_dimension;
spl_handler_ArrayClass.unset_dimension = spl_array_unset_dimension;
+ spl_handler_ArrayClass.has_dimension = spl_array_has_dimension;
spl_handler_ArrayClass.get_properties = spl_array_get_properties;
REGISTER_SPL_STD_CLASS_EX(ArrayIterator, spl_array_object_new,
spl_funcs_ArrayIterator);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php