cvs: ZendEngine2(PHP_5_0) / zend_builtin_functions.c

From: Date: Mon, 04 Oct 2004 09:03:11 +0000
Subject: cvs: ZendEngine2(PHP_5_0) / zend_builtin_functions.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3075@lists.php.net to get a copy of this message
helly Mon Oct 4 05:03:11 2004 EDT Modified files: (Branch: PHP_5_0) /ZendEngine2 zend_builtin_functions.c Log: MFH http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.c?r1=1.239.2.6&r2=1.239.2.7&ty=u Index: ZendEngine2/zend_builtin_functions.c diff -u ZendEngine2/zend_builtin_functions.c:1.239.2.6 ZendEngine2/zend_builtin_functions.c:1.239.2.7 --- ZendEngine2/zend_builtin_functions.c:1.239.2.6 Tue Aug 24 21:02:38 2004 +++ ZendEngine2/zend_builtin_functions.c Mon Oct 4 05:03:10 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_builtin_functions.c,v 1.239.2.6 2004/08/25 01:02:38 andi Exp $ */ +/* $Id: zend_builtin_functions.c,v 1.239.2.7 2004/10/04 09:03:10 helly Exp $ */ #include "zend.h" #include "zend_API.h" @@ -723,9 +723,10 @@ zval **value; HashTable *properties; HashPosition pos; - char *key; + char *key, *prop_name, *class_name; uint key_len; ulong num_index; + int instanceof; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &obj) == FAILURE) { ZEND_WRONG_PARAM_COUNT(); @@ -738,16 +739,27 @@ RETURN_FALSE; } + instanceof = EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), Z_OBJCE_PP(obj) TSRMLS_CC); + array_init(return_value); properties = Z_OBJ_HT_PP(obj)->get_properties(*obj TSRMLS_CC); zend_hash_internal_pointer_reset_ex(properties, &pos); while (zend_hash_get_current_data_ex(properties, (void **) &value, &pos) == SUCCESS) { - if (zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos) == HASH_KEY_IS_STRING && key[0]) { + if (zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos) == HASH_KEY_IS_STRING) { + if (key[0]) { /* Not separating references */ (*value)->refcount++; add_assoc_zval_ex(return_value, key, key_len, *value); + } else if (instanceof) { + zend_unmangle_property_name(key, &class_name, &prop_name); + if (!memcmp(class_name, "*", 2) || (Z_OBJCE_P(EG(This)) == Z_OBJCE_PP(obj) && !strcmp(Z_OBJCE_P(EG(This))->name, class_name))) { + /* Not separating references */ + (*value)->refcount++; + add_assoc_zval_ex(return_value, prop_name, strlen(prop_name)+1, *value); + } + } } zend_hash_move_forward_ex(properties, &pos); }

« previous php.zend-engine.cvs (#3075) next »