cvs: /php4/ext/standard array.c basic_functions.c

From: Date: Sun, 19 Dec 1999 18:58:57 +0000
Subject: cvs: /php4/ext/standard array.c basic_functions.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-8176@lists.php.net to get a copy of this message
zeev Sun Dec 19 13:58:57 1999 EDT Modified files: /php4/ext/standard array.c basic_functions.c Log: Support the latest update to call_user_function_ex() Index: php4/ext/standard/array.c diff -u php4/ext/standard/array.c:1.15 php4/ext/standard/array.c:1.16 --- php4/ext/standard/array.c:1.15 Sat Dec 18 17:35:26 1999 +++ php4/ext/standard/array.c Sun Dec 19 13:58:27 1999 @@ -387,7 +387,7 @@ Bucket *f; Bucket *s; pval **args[2]; - pval retval; + pval *retval_ptr; CLS_FETCH(); BLS_FETCH(); @@ -397,9 +397,14 @@ args[0] = (pval **) f->pData; args[1] = (pval **) s->pData; - if (call_user_function_ex(CG(function_table), NULL, *BG(user_compare_func_name), &retval, 2, args, 0)==SUCCESS) { - convert_to_long(&retval); - return retval.value.lval; + if (call_user_function_ex(CG(function_table), NULL, *BG(user_compare_func_name), &retval_ptr, 2, args, 0)==SUCCESS + && retval_ptr) { + long retval; + + convert_to_long_ex(&retval_ptr); + retval = retval_ptr->value.lval; + zval_ptr_dtor(&retval_ptr); + return retval; } else { return 0; } @@ -795,7 +800,7 @@ static int php_array_walk(HashTable *target_hash, zval **userdata) { zval **args[3], /* Arguments to userland function */ - retval, /* Return value - unused */ + *retval_ptr, /* Return value - unused */ *key; /* Entry key */ char *string_key; ulong num_key; @@ -823,8 +828,11 @@ /* Call the userland function */ call_user_function_ex(CG(function_table), NULL, *BG(array_walk_func_name), - &retval, userdata ? 3 : 2, args, 0); + &retval_ptr, userdata ? 3 : 2, args, 0); + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } /* Clean up the key */ if (zend_hash_get_current_key_type(target_hash) == HASH_KEY_IS_STRING) efree(key->value.str.val); Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.142 php4/ext/standard/basic_functions.c:1.143 --- php4/ext/standard/basic_functions.c:1.142 Sat Dec 18 17:35:27 1999 +++ php4/ext/standard/basic_functions.c Sun Dec 19 13:58:27 1999 @@ -943,7 +943,7 @@ PHP_FUNCTION(call_user_func) { pval ***params; - pval retval; + pval *retval_ptr; int arg_count=ARG_COUNT(ht); CLS_FETCH(); @@ -958,8 +958,9 @@ } SEPARATE_ZVAL(params[0]); convert_to_string(*params[0]); - if (call_user_function_ex(CG(function_table), NULL, *params[0], &retval, arg_count-1, params+1, 1)==SUCCESS) { - *return_value = retval; + if (call_user_function_ex(CG(function_table), NULL, *params[0], &retval_ptr, arg_count-1, params+1, 1)==SUCCESS + && retval_ptr) { + COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); } else { php_error(E_WARNING,"Unable to call %s() - function does not exist", (*params[0])->value.str.val); } @@ -970,7 +971,7 @@ PHP_FUNCTION(call_user_method) { pval ***params; - pval retval; + pval *retval_ptr; int arg_count=ARG_COUNT(ht); CLS_FETCH(); @@ -991,8 +992,9 @@ SEPARATE_ZVAL(params[0]); SEPARATE_ZVAL(params[1]); convert_to_string(*params[0]); - if (call_user_function_ex(CG(function_table), *params[1], *params[0], &retval, arg_count-2, params+2, 1)==SUCCESS) { - *return_value = retval; + if (call_user_function_ex(CG(function_table), *params[1], *params[0], &retval_ptr, arg_count-2, params+2, 1)==SUCCESS + && retval_ptr) { + COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); } else { php_error(E_WARNING,"Unable to call %s() - function does not exist", (*params[0])->value.str.val); }

« previous php.version4 (#8176) next »