colder Mon Jun 9 17:29:23 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/spl spl_fastarray.c Log: add get_debug_info http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_fastarray.c?r1=1.1.2.6&r2=1.1.2.7&diff_format=u Index: php-src/ext/spl/spl_fastarray.c diff -u php-src/ext/spl/spl_fastarray.c:1.1.2.6 php-src/ext/spl/spl_fastarray.c:1.1.2.7 --- php-src/ext/spl/spl_fastarray.c:1.1.2.6 Sat Jun 7 21:36:13 2008 +++ php-src/ext/spl/spl_fastarray.c Mon Jun 9 17:29:23 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_fastarray.c,v 1.1.2.6 2008/06/07 21:36:13 tony2001 Exp $ */ +/* $Id: spl_fastarray.c,v 1.1.2.7 2008/06/09 17:29:23 colder Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -143,6 +143,49 @@ } /* }}} */ +static HashTable* spl_fastarray_object_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /* {{{{ */ +{ + spl_fastarray_object *intern = (spl_fastarray_object*)zend_object_store_get_object(obj TSRMLS_CC); + HashTable *rv; + zval *tmp, zrv, *fastarray_array; + char *pnstr; + int pnlen; + int i = 0;; + + *is_temp = 1; + + ALLOC_HASHTABLE(rv); + ZEND_INIT_SYMTABLE_EX(rv, zend_hash_num_elements(intern->std.properties) + 1, 0); + + INIT_PZVAL(&zrv); + Z_ARRVAL(zrv) = rv; + + zend_hash_copy(rv, intern->std.properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + + ALLOC_INIT_ZVAL(fastarray_array); + array_init(fastarray_array); + + + if (intern->array) { + for (i = 0; i < intern->array->size; i++) { + if (intern->array->elements[i]) { + add_index_zval(fastarray_array, i, (zval *)intern->array->elements[i]); + Z_ADDREF_P(intern->array->elements[i]); + } else { + add_index_zval(fastarray_array, i, (zval *)EG(uninitialized_zval_ptr)); + Z_ADDREF_P(EG(uninitialized_zval_ptr)); + } + } + } + + pnstr = spl_gen_private_prop_name(spl_ce_SplFastArray, "array", sizeof("array")-1, &pnlen TSRMLS_CC); + add_assoc_zval_ex(&zrv, pnstr, pnlen+1, fastarray_array); + efree(pnstr); + + return rv; +} +/* }}}} */ + static void spl_fastarray_object_free_storage(void *object TSRMLS_DC) /* {{{ */ { spl_fastarray_object *intern = (spl_fastarray_object *)object; @@ -907,6 +950,7 @@ spl_handler_SplFastArray.unset_dimension = spl_fastarray_object_unset_dimension; spl_handler_SplFastArray.has_dimension = spl_fastarray_object_has_dimension; spl_handler_SplFastArray.count_elements = spl_fastarray_object_count_elements; + spl_handler_SplFastArray.get_debug_info = spl_fastarray_object_get_debug_info; REGISTER_SPL_IMPLEMENTS(SplFastArray, Iterator); REGISTER_SPL_IMPLEMENTS(SplFastArray, ArrayAccess);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php