diff options
| author | Zeev Suraski <zeev@php.net> | 1999-12-19 18:58:27 +0000 |
|---|---|---|
| committer | Zeev Suraski <zeev@php.net> | 1999-12-19 18:58:27 +0000 |
| commit | 489de5dce2395cdd9ada826950ad80574be28f27 (patch) | |
| tree | c251aa540707f0a54e35cf19cb8b948d5aec016d /ext/standard/array.c | |
| parent | 223c674c2a6f014e013c2ff0737febd22b19f96d (diff) | |
| download | php-git-489de5dce2395cdd9ada826950ad80574be28f27.tar.gz | |
Support the latest update to call_user_function_ex()
Diffstat (limited to 'ext/standard/array.c')
| -rw-r--r-- | ext/standard/array.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index 02a855a5d0..e18d122b4b 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -387,7 +387,7 @@ static int array_user_compare(const void *a, const void *b) Bucket *f; Bucket *s; pval **args[2]; - pval retval; + pval *retval_ptr; CLS_FETCH(); BLS_FETCH(); @@ -397,9 +397,14 @@ static int array_user_compare(const void *a, const void *b) 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 @@ PHP_FUNCTION(max) 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 @@ static int php_array_walk(HashTable *target_hash, zval **userdata) /* 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); |
