]> granicus.if.org Git - php/commitdiff
zend_is_callable() and zend_make_callable() were changed to return readable function...
authorDmitry Stogov <dmitry@php.net>
Mon, 22 Aug 2005 12:22:16 +0000 (12:22 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 22 Aug 2005 12:22:16 +0000 (12:22 +0000)
23 files changed:
Zend/zend_API.c
Zend/zend_API.h
Zend/zend_builtin_functions.c
Zend/zend_execute_API.c
ext/fdf/fdf.c
ext/ldap/ldap.c
ext/mysqli/mysqli_api.c
ext/pcntl/pcntl.c
ext/pcre/php_pcre.c
ext/pdo/pdo_stmt.c
ext/pdo_sqlite/sqlite_driver.c
ext/readline/readline.c
ext/session/session.c
ext/spl/php_spl.c
ext/spl/spl_iterators.c
ext/sqlite/sqlite.c
ext/standard/array.c
ext/standard/basic_functions.c
ext/standard/type.c
ext/sybase_ct/php_sybase_ct.c
ext/xsl/xsltprocessor.c
main/output.c
unicode-progress.txt

index 4b103bb4633e61944aabfb87f8320bb0bb80d602..2a950e7d726e37ef54a8fef305aa96a634865078 100644 (file)
@@ -2399,18 +2399,14 @@ ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_
        return 1;
 }
 
-ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC)
+ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, zval *callable_name, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC)
 {
        unsigned int lcname_len;
        char *lcname;
        zend_bool retval = 0; 
-       int callable_name_len_local;
        zend_function *fptr_local;
        zval **zobj_ptr_local;
 
-       if (callable_name_len == NULL) {
-               callable_name_len = &callable_name_len_local;
-       }
        if (fptr_ptr == NULL) {
                fptr_ptr = &fptr_local;
        }
@@ -2424,13 +2420,9 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
                case IS_STRING:
                case IS_UNICODE:
                        if (callable_name) {
-                               /* UTODO: we need to return callable name type as well */
-                               if (Z_TYPE_P(callable) == IS_UNICODE) {
-                                       *callable_name = (char*)eustrndup(Z_USTRVAL_P(callable), Z_USTRLEN_P(callable));
-                               } else {
-                                       *callable_name = estrndup(Z_STRVAL_P(callable), Z_STRLEN_P(callable));
-                               }
-                               *callable_name_len = Z_UNILEN_P(callable);
+                               *callable_name = *callable;
+                               zval_copy_ctor(callable_name);
+                               convert_to_text(callable_name);
                        }
                        if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
                                return 1;
@@ -2460,15 +2452,59 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
 
                                        if (Z_TYPE_PP(obj) == IS_STRING || Z_TYPE_PP(obj) == IS_UNICODE) {
                                                if (callable_name) {
-                                                       char *ptr;
-
-                                                       *callable_name_len = Z_STRLEN_PP(obj) + Z_STRLEN_PP(method) + sizeof("::") - 1;
-                                                       ptr = *callable_name = emalloc(*callable_name_len + 1);
-                                                       memcpy(ptr, Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
-                                                       ptr += Z_STRLEN_PP(obj);
-                                                       memcpy(ptr, "::", sizeof("::") - 1);
-                                                       ptr += sizeof("::") - 1;
-                                                       memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
+                                                       if (UG(unicode)) {
+                                                               Z_TYPE_P(callable_name) = IS_UNICODE;
+                                                               Z_USTRLEN_P(callable_name) = Z_UNILEN_PP(obj) + Z_UNILEN_PP(method) + 2;
+                                                               Z_USTRVAL_P(callable_name) = eumalloc(Z_USTRLEN_P(callable_name)+1);
+                                                               if (Z_TYPE_PP(obj) == IS_UNICODE) {
+                                                                       memcpy(Z_USTRVAL_P(callable_name), Z_USTRVAL_PP(obj), UBYTES(Z_USTRLEN_PP(obj)));
+                                                               } else {
+                                                                       zval copy;
+                                                                       int use_copy;
+
+                                                                       zend_make_unicode_zval(*obj, &copy, &use_copy);
+                                                                       memcpy(Z_USTRVAL_P(callable_name), Z_USTRVAL(copy), UBYTES(Z_USTRLEN(copy)));
+                                                                       zval_dtor(&copy);
+                                                               }
+                                                               Z_USTRVAL_P(callable_name)[Z_UNILEN_PP(obj)] = ':';
+                                                               Z_USTRVAL_P(callable_name)[Z_UNILEN_PP(obj)+1] = ':';
+                                                               if (Z_TYPE_PP(method) == IS_UNICODE) {
+                                                                       memcpy(Z_USTRVAL_P(callable_name)+Z_UNILEN_PP(obj)+2, Z_USTRVAL_PP(method), UBYTES(Z_USTRLEN_PP(method)+1));
+                                                               } else {
+                                                                       zval copy;
+                                                                       int use_copy;
+
+                                                                       zend_make_unicode_zval(*method, &copy, &use_copy);
+                                                                       memcpy(Z_USTRVAL_P(callable_name)+Z_UNILEN_PP(obj)+2, Z_USTRVAL(copy), UBYTES(Z_USTRLEN(copy)+1));
+                                                                       zval_dtor(&copy);
+                                                               }
+                                                       } else {
+                                                               Z_TYPE_P(callable_name) = IS_STRING;
+                                                               Z_STRLEN_P(callable_name) = Z_UNILEN_PP(obj) + Z_UNILEN_PP(method) + 2;
+                                                               Z_STRVAL_P(callable_name) = emalloc(Z_STRLEN_P(callable_name)+1);
+                                                               if (Z_TYPE_PP(obj) == IS_STRING) {
+                                                                       memcpy(Z_STRVAL_P(callable_name), Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
+                                                               } else {
+                                                                       zval copy;
+                                                                       int use_copy;
+
+                                                                       zend_make_string_zval(*obj, &copy, &use_copy);
+                                                                       memcpy(Z_STRVAL_P(callable_name), Z_STRVAL(copy), Z_STRLEN(copy));
+                                                                       zval_dtor(&copy);
+                                                               }
+                                                               Z_STRVAL_P(callable_name)[Z_UNILEN_PP(obj)] = ':';
+                                                               Z_STRVAL_P(callable_name)[Z_UNILEN_PP(obj)+1] = ':';
+                                                               if (Z_TYPE_PP(method) == IS_STRING) {
+                                                                       memcpy(Z_STRVAL_P(callable_name)+Z_UNILEN_PP(obj)+2, Z_STRVAL_PP(method), Z_STRLEN_PP(method)+1);
+                                                               } else {
+                                                                       zval copy;
+                                                                       int use_copy;
+
+                                                                       zend_make_string_zval(*method, &copy, &use_copy);
+                                                                       memcpy(Z_STRVAL_P(callable_name)+Z_UNILEN_PP(obj)+2, Z_STRVAL(copy), Z_STRLEN(copy)+1);
+                                                                       zval_dtor(&copy);
+                                                               }
+                                                       }
                                                }
 
                                                if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY)
@@ -2495,15 +2531,41 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
                                                *zobj_ptr_ptr = obj;
 
                                                if (callable_name) {
-                                                       char *ptr;
-
-                                                       *callable_name_len = ce->name_length + Z_STRLEN_PP(method) + sizeof("::") - 1;
-                                                       ptr = *callable_name = emalloc(*callable_name_len + 1);
-                                                       memcpy(ptr, ce->name, ce->name_length);
-                                                       ptr += ce->name_length;
-                                                       memcpy(ptr, "::", sizeof("::") - 1);
-                                                       ptr += sizeof("::") - 1;
-                                                       memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
+                                                       if (UG(unicode)) {
+                                                               Z_TYPE_P(callable_name) = IS_UNICODE;
+                                                               Z_USTRLEN_P(callable_name) = ce->name_length + Z_UNILEN_PP(method) + 2;
+                                                               Z_USTRVAL_P(callable_name) = eumalloc(Z_USTRLEN_P(callable_name)+1);
+                                                               memcpy(Z_USTRVAL_P(callable_name), ce->name, UBYTES(ce->name_length));
+                                                               Z_USTRVAL_P(callable_name)[ce->name_length] = ':';
+                                                               Z_USTRVAL_P(callable_name)[ce->name_length+1] = ':';
+                                                               if (Z_TYPE_PP(method) == IS_UNICODE) {
+                                                                       memcpy(Z_USTRVAL_P(callable_name)+ce->name_length+2, Z_USTRVAL_PP(method), UBYTES(Z_USTRLEN_PP(method)+1));
+                                                               } else {
+                                                                       zval copy;
+                                                                       int use_copy;
+
+                                                                       zend_make_unicode_zval(*method, &copy, &use_copy);
+                                                                       memcpy(Z_USTRVAL_P(callable_name)+ce->name_length+2, Z_USTRVAL(copy), UBYTES(Z_USTRLEN(copy)+1));
+                                                                       zval_dtor(&copy);
+                                                               }
+                                                       } else {
+                                                               Z_TYPE_P(callable_name) = IS_STRING;
+                                                               Z_STRLEN_P(callable_name) = ce->name_length + Z_UNILEN_PP(method) + 2;
+                                                               Z_STRVAL_P(callable_name) = emalloc(Z_STRLEN_P(callable_name)+1);
+                                                               memcpy(Z_STRVAL_P(callable_name), ce->name, ce->name_length);
+                                                               Z_STRVAL_P(callable_name)[ce->name_length] = ':';
+                                                               Z_STRVAL_P(callable_name)[ce->name_length+1] = ':';
+                                                               if (Z_TYPE_PP(method) == IS_STRING) {
+                                                                       memcpy(Z_STRVAL_P(callable_name)+ce->name_length+2, Z_STRVAL_PP(method), Z_STRLEN_PP(method)+1);
+                                                               } else {
+                                                                       zval copy;
+                                                                       int use_copy;
+
+                                                                       zend_make_string_zval(*method, &copy, &use_copy);
+                                                                       memcpy(Z_STRVAL_P(callable_name)+ce->name_length+2, Z_STRVAL(copy), Z_STRLEN(copy)+1);
+                                                                       zval_dtor(&copy);
+                                                               }
+                                                       }
                                                }
 
                                                if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY)
@@ -2542,21 +2604,16 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
                                                efree(lcname);
                                        }
                                } else if (callable_name) {
-                                       *callable_name = estrndup("Array", sizeof("Array")-1);
-                                       *callable_name_len = sizeof("Array") - 1;
+                                       ZVAL_ASCII_STRINGL(callable_name, "Array", sizeof("Array")-1, 1);
                                }
                        }
                        break;
 
                default:
                        if (callable_name) {
-                               zval expr_copy;
-                               int use_copy;
-
-                               zend_make_printable_zval(callable, &expr_copy, &use_copy);
-                               *callable_name = estrndup(Z_STRVAL(expr_copy), Z_STRLEN(expr_copy));
-                               *callable_name_len = Z_STRLEN(expr_copy);
-                               zval_dtor(&expr_copy);
+                               *callable_name = *callable;
+                               zval_copy_ctor(callable_name);
+                               convert_to_text(callable_name);
                        }
                        break;
        }
@@ -2565,22 +2622,22 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
 }
 
 
-ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name)
+ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, zval *callable_name)
 {
        TSRMLS_FETCH();
 
-       return zend_is_callable_ex(callable, check_flags, callable_name, NULL, NULL, NULL TSRMLS_CC);
+       return zend_is_callable_ex(callable, check_flags, callable_name, NULL, NULL TSRMLS_CC);
 }
 
 
-ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC)
+ZEND_API zend_bool zend_make_callable(zval *callable, zval *callable_name TSRMLS_DC)
 {
        char *lcname, *func, *class_name;
        zend_bool retval = 0;
        zend_class_entry **pce;
        int class_name_len;
 
-       if (zend_is_callable_ex(callable, 0, callable_name, NULL, NULL, NULL TSRMLS_CC)) {
+       if (zend_is_callable_ex(callable, 0, callable_name, NULL, NULL TSRMLS_CC)) {
                return 1;
        }
        switch (Z_TYPE_P(callable)) {
@@ -2880,7 +2937,7 @@ ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object
        zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
 }
 
-ZEND_API void zend_update_property_unicode(zend_class_entry *scope, zval *object, UChar *name, int name_length, char *value TSRMLS_DC)
+ZEND_API void zend_update_property_unicode(zend_class_entry *scope, zval *object, char *name, int name_length, UChar *value TSRMLS_DC)
 {
        zval *tmp;
        
@@ -2891,7 +2948,7 @@ ZEND_API void zend_update_property_unicode(zend_class_entry *scope, zval *object
        zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
 }
 
-ZEND_API void zend_update_property_unicodel(zend_class_entry *scope, zval *object, UChar *name, int name_length, char *value, int value_len TSRMLS_DC)
+ZEND_API void zend_update_property_unicodel(zend_class_entry *scope, zval *object, char *name, int name_length, UChar *value, int value_len TSRMLS_DC)
 {
        zval *tmp;
        
index 44937c7152cf91f753a726a4b30543c883ffc52c..136ed812298629d41aeac107a2607fbc58f5ed5e 100644 (file)
@@ -203,9 +203,9 @@ ZEND_API void zend_wrong_param_count(TSRMLS_D);
 #define IS_CALLABLE_CHECK_NO_ACCESS   (1<<1)
 #define IS_CALLABLE_CHECK_IS_STATIC   (1<<2)
 
-ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC);
-ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name);
-ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC);
+ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, zval *callable_name, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC);
+ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, zval *callable_name);
+ZEND_API zend_bool zend_make_callable(zval *callable, zval *callable_name TSRMLS_DC);
 ZEND_API char *zend_get_module_version(char *module_name);
 ZEND_API int zend_get_module_started(char *module_name);
 ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC);
@@ -228,8 +228,8 @@ ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, c
 ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, char *name, int name_length, double value TSRMLS_DC);
 ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC);
 ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_length TSRMLS_DC);
-ZEND_API void zend_update_property_unicode(zend_class_entry *scope, zval *object, UChar *name, int name_length, char *value TSRMLS_DC);
-ZEND_API void zend_update_property_unicodel(zend_class_entry *scope, zval *object, UChar *name, int name_length, char *value, int value_length TSRMLS_DC);
+ZEND_API void zend_update_property_unicode(zend_class_entry *scope, zval *object, char *name, int name_length, UChar *value TSRMLS_DC);
+ZEND_API void zend_update_property_unicodel(zend_class_entry *scope, zval *object, char *name, int name_length, UChar *value, int value_length TSRMLS_DC);
 
 ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC);
 
index d489fe9b7e2a731070ffae9a6d8f7fa394ffe2c8..486f84131a59d70935c81e5086c9d5604da11f41 100644 (file)
@@ -1202,7 +1202,7 @@ ZEND_FUNCTION(set_error_handler)
 {
        zval *error_handler;
        zend_bool had_orig_error_handler=0;
-       char *error_handler_name = NULL;
+       zval error_handler_name;
        long error_type = E_ALL | E_STRICT;
  
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &error_handler, &error_type) == FAILURE) {
@@ -1210,12 +1210,12 @@ ZEND_FUNCTION(set_error_handler)
        }
 
        if (!zend_is_callable(error_handler, 0, &error_handler_name)) {
-               zend_error(E_WARNING, "%v() expects the argument (%s) to be a valid callback",
-                                  get_active_function_name(TSRMLS_C), error_handler_name?error_handler_name:"unknown");
-               efree(error_handler_name);
+               zend_error(E_WARNING, "%v() expects the argument (%R) to be a valid callback",
+                                  get_active_function_name(TSRMLS_C), Z_TYPE(error_handler_name), Z_UNIVAL(error_handler_name));
+               zval_dtor(&error_handler_name);
                return;
        }
-       efree(error_handler_name);
+       zval_dtor(&error_handler_name);
 
        if (EG(user_error_handler)) {
                had_orig_error_handler = 1;
@@ -1271,7 +1271,7 @@ ZEND_FUNCTION(restore_error_handler)
 ZEND_FUNCTION(set_exception_handler)
 {
        zval **exception_handler;
-       char *exception_handler_name = NULL;
+       zval exception_handler_name;
        zend_bool had_orig_exception_handler=0;
 
        if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &exception_handler)==FAILURE) {
@@ -1280,12 +1280,12 @@ ZEND_FUNCTION(set_exception_handler)
 
        if (Z_TYPE_PP(exception_handler) != IS_NULL) { /* NULL == unset */
                if (!zend_is_callable(*exception_handler, 0, &exception_handler_name)) {
-                       zend_error(E_WARNING, "%v() expects the argument (%s) to be a valid callback",
-                                          get_active_function_name(TSRMLS_C), exception_handler_name?exception_handler_name:"unknown");
-                       efree(exception_handler_name);
+                       zend_error(E_WARNING, "%v() expects the argument (%R) to be a valid callback",
+                                          get_active_function_name(TSRMLS_C), Z_TYPE(exception_handler_name), Z_UNIVAL(exception_handler_name));
+                       zval_dtor(&exception_handler_name);
                        return;
                }
-               efree(exception_handler_name);
+               zval_dtor(&exception_handler_name);
        }
 
        if (EG(user_exception_handler)) {
index 2de3928f17c20bb9b19ae1e7e189e3aa61d41005..0c70d9ee16631bbbd181be4c39923ce34437d7b7 100644 (file)
@@ -799,6 +799,11 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
                                array_init(params_array);
                                call_via_handler = 1;
                        } else {
+                               if (old_func_name) {
+                                       efree(Z_STRVAL_P(fci->function_name));
+                                       Z_TYPE_P(fci->function_name) = IS_STRING;
+                                       Z_STRVAL_P(fci->function_name) = old_func_name;
+                               }
                                return FAILURE;
                        }
                }
@@ -828,6 +833,11 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
                                                zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) (long) i, NULL);
                                                zend_ptr_stack_clear_multiple(TSRMLS_C);
                                        }
+                                       if (old_func_name) {
+                                               efree(Z_STRVAL_P(fci->function_name));
+                                               Z_TYPE_P(fci->function_name) = IS_STRING;
+                                               Z_STRVAL_P(fci->function_name) = old_func_name;
+                                       }
                                        return FAILURE;
                                }
                                ALLOC_ZVAL(new_zval);
@@ -1038,10 +1048,6 @@ ZEND_API int zend_u_lookup_class(zend_uchar type, void *name, int name_length, z
        retval = zend_call_function(&fcall_info, &fcall_cache TSRMLS_CC);
        EG(autoload_func) = fcall_cache.function_handler;
 
-       if (UG(unicode)) {
-               zval_dtor(&autoload_function);
-       }
-
        zval_ptr_dtor(&class_name_ptr);
 
        zend_u_hash_del(EG(in_autoload), type, lc_name, lc_name_len+1);
index 3ed745b1e3c6444efa98c5791ab44be8d622e7e6..66ec51d9962d012425f67666895aec21709def77 100644 (file)
@@ -1573,7 +1573,7 @@ PHP_FUNCTION(fdf_enum_values) {
        zval *userdata = NULL;
        FDFDoc fdf;
        FDFErc err;
-       char *name;
+       zval name;
        char namebuf[1024], valbuf[1024];
 
        if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz|z", &r_fdf, 
@@ -1586,11 +1586,12 @@ PHP_FUNCTION(fdf_enum_values) {
        ZEND_FETCH_RESOURCE(fdf, FDFDoc *, &r_fdf, -1, "fdf", le_fdf);
 
        if (!zend_is_callable(callback, 0, &name)) {
-               php_error_docref1(NULL TSRMLS_CC, name, E_WARNING, "Second argument is expected to be a valid callback");
-               efree(name);
+               convert_to_string(&name);
+               php_error_docref1(NULL TSRMLS_CC, Z_STRVAL(name), E_WARNING, "Second argument is expected to be a valid callback");
+               zval_ptr_dtor(&name);
                RETURN_FALSE;
        }
-       efree(name);
+       zval_ptr_dtor(&name);
        FDF_G(enum_callback) = callback;
        FDF_G(enum_fdf) = fdf;
 
index 777e6acdcc57c78cd9cd79e1ee50f24cb4654306..bffe17c11b2fcf760b7a6ef2e26acaba913d2ec0 100644 (file)
@@ -2199,7 +2199,7 @@ PHP_FUNCTION(ldap_set_rebind_proc)
 {
        zval *link, *callback;
        ldap_linkdata *ld;
-       char *callback_name;
+       zval callback_name;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz", &link, &callback) == FAILURE) {
                RETURN_FALSE;
@@ -2219,11 +2219,11 @@ PHP_FUNCTION(ldap_set_rebind_proc)
 
        /* callable? */
        if (!zend_is_callable(callback, 0, &callback_name)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Two arguments expected for '%s' to be a valid callback", callback_name);
-               efree(callback_name);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Two arguments expected for '%R' to be a valid callback", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
+               zval_dtor(&callback_name);
                RETURN_FALSE;
        }
-       efree(callback_name);
+       zval_dtor(&callback_name);
 
        /* register rebind procedure */
        if (ld->rebindproc == NULL) {
index 042c2b417a4ff3d10af20161278311e74bd971da..c4086909728c18f0b2f69ddf8a67a9f3f5ff045a 100644 (file)
@@ -1105,7 +1105,7 @@ PHP_FUNCTION(mysqli_set_local_infile_handler)
 {
        MY_MYSQL        *mysql;
        zval            *mysql_link;
-       char            *callback_name;
+       zval     callback_name;
        zval            *callback_func;
 
        if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz", &mysql_link, mysqli_link_class_entry,
@@ -1117,11 +1117,11 @@ PHP_FUNCTION(mysqli_set_local_infile_handler)
 
        /* check callback function */
        if (!zend_is_callable(callback_func, 0, &callback_name)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback function %s", callback_name);
-               efree(callback_name);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback function %R", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
+               zval_dtor(&callback_name);
                RETURN_FALSE;           
        }
-       efree(callback_name);
+       zval_dtor(&callback_name);
 
        /* save callback function */
        ALLOC_ZVAL(mysql->li_read);     
index dc347a8fd76e62d67abf343a0bdf9a1e9cb1add7..94af3d64cea84ad7e8736f65481a67fe2dae7959 100755 (executable)
@@ -521,7 +521,7 @@ PHP_FUNCTION(pcntl_exec)
 PHP_FUNCTION(pcntl_signal)
 {
        zval *handle, **dest_handle = NULL;
-       char *func_name;
+       zval func_name;
        long signo;
        zend_bool restart_syscalls = 1;
 
@@ -555,11 +555,11 @@ PHP_FUNCTION(pcntl_signal)
        }
        
        if (!zend_is_callable(handle, 0, &func_name)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not a callable function name error", func_name);
-               efree(func_name);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%R is not a callable function name error", Z_TYPE(func_name), Z_UNIVAL(func_name));
+               zval_dtor(&func_name);
                RETURN_FALSE;
        }
-       efree(func_name);
+       zval_dtor(&func_name);
        
        /* Add the function name to our signal table */
        zend_hash_index_update(&PCNTL_G(php_signal_table), signo, (void **) &handle, sizeof(zval *), (void **) &dest_handle);
index ea539803e1f2de56c8dd5a6ea77f971a1865cf66..a0846214ba5c90e8c20cbd3b5accee34f18ced9e 100644 (file)
@@ -1128,7 +1128,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_callabl
        int                              limit_val = -1;
        char                    *string_key;
        ulong                    num_key;
-       char                    *callback_name = NULL;
+       zval                     callback_name;
     int                                replace_count=0;
     int             *replace_count_ptr=NULL; 
        
@@ -1147,13 +1147,13 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_callabl
                convert_to_string_ex(replace);
        if (is_callable_replace) {
                if (!zend_is_callable(*replace, 0, &callback_name)) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "requires argument 2, '%s', to be a valid callback", callback_name);
-                       efree(callback_name);
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "requires argument 2, '%R', to be a valid callback", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
+                       zval_dtor(&callback_name);
                        *return_value = **subject;
                        zval_copy_ctor(return_value);
                        return;
                }
-               efree(callback_name);
+               zval_dtor(&callback_name);
        }
 
        SEPARATE_ZVAL(regex);
index af0c5d3cf587f5d57e85102722b1478496c6c794..085a82270b203da274a1d2a4f24d7ff770fabcba 100755 (executable)
@@ -632,7 +632,6 @@ static int do_fetch_class_prepare(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
 static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info * fci, zend_fcall_info_cache * fcc, int num_args TSRMLS_DC) /* {{{ */
 {
        zval **object = NULL, **method;
-       char *fname;
        zend_class_entry * ce = NULL, **pce;
        zend_function *function_handler;
        
@@ -667,7 +666,7 @@ static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info *
                method = &callable;
        }
        
-       if (!zend_is_callable(callable, 0, &fname)) {
+       if (!zend_is_callable(callable, 0, NULL)) {
                pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function must be a valid callback" TSRMLS_CC);
                return 0;
        }
@@ -677,7 +676,6 @@ static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info *
                pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function does not exist" TSRMLS_CC);
                return 0;
        }
-       efree(fname);
 
        fci->size = sizeof(zend_fcall_info);
        fci->function_name = NULL;
index b5304410b9722e8cafcb4213c6ce051aa61bbfa3..a93aec9eeff0f3d9ff22c104fb4e8b9513ab02aa 100644 (file)
@@ -457,7 +457,7 @@ static PHP_METHOD(SQLite, sqliteCreateFunction)
        char *func_name;
        int func_name_len;
        long argc = -1;
-       char *cbname = NULL;
+       zval cbname;
        pdo_dbh_t *dbh;
        pdo_sqlite_db_handle *H;
        int ret;
@@ -470,11 +470,11 @@ static PHP_METHOD(SQLite, sqliteCreateFunction)
        dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
 
        if (!zend_is_callable(callback, 0, &cbname)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname);
-               efree(cbname);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%R' is not callable", Z_TYPE(cbname), Z_UNIVAL(cbname));
+               zval_dtor(&cbname);
                RETURN_FALSE;
        }
-       efree(cbname);
+       zval_dtor(&cbname);
        
        H = (pdo_sqlite_db_handle *)dbh->driver_data;
 
@@ -528,7 +528,7 @@ static PHP_METHOD(SQLite, sqliteCreateAggregate)
        char *func_name;
        int func_name_len;
        long argc = -1;
-       char *cbname = NULL;
+       zval cbname;
        pdo_dbh_t *dbh;
        pdo_sqlite_db_handle *H;
        int ret;
@@ -541,17 +541,17 @@ static PHP_METHOD(SQLite, sqliteCreateAggregate)
        dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
 
        if (!zend_is_callable(step_callback, 0, &cbname)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname);
-               efree(cbname);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%R' is not callable", Z_TYPE(cbname), Z_UNIVAL(cbname));
+               zval_dtor(&cbname);
                RETURN_FALSE;
        }
-       efree(cbname);
+       zval_dtor(&cbname);
        if (!zend_is_callable(fini_callback, 0, &cbname)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname);
-               efree(cbname);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%R' is not callable", Z_TYPE(cbname), Z_UNIVAL(cbname));
+               zval_dtor(&cbname);
                RETURN_FALSE;
        }
-       efree(cbname);
+       zval_dtor(&cbname);
        
        H = (pdo_sqlite_db_handle *)dbh->driver_data;
 
index f86fdfcd0771701a818b0ae8dc265070216eee2a..8dbfb46157c8602d190dcd3024180e6348b195cd 100644 (file)
@@ -441,16 +441,18 @@ static char **_readline_completion_cb(const char *text, int start, int end)
 PHP_FUNCTION(readline_completion_function)
 {
        zval *arg = NULL;
-       char *name = NULL;
+       zval name;
 
        if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg)) {
                RETURN_FALSE;
        }
 
        if (!zend_is_callable(arg, 0, &name)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not callable", name);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%R is not callable", Z_TYPE(name), Z_UNIVAL(name));
+               zval_dtor(&name);
                RETURN_FALSE;
        }
+       zval_dtor(&name);
 
        if (_readline_completion)
                FREE_ZVAL(_readline_completion);
@@ -489,7 +491,7 @@ static void php_rl_callback_handler(char *the_line)
 PHP_FUNCTION(readline_callback_handler_install)
 {
        zval *callback;
-       char *name = NULL;
+       zval name;
        char *prompt;
        int prompt_len;
 
@@ -498,9 +500,11 @@ PHP_FUNCTION(readline_callback_handler_install)
        }
 
        if (!zend_is_callable(callback, 0, &name)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not callable", name);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%R is not callable", Z_TYPE(name), Z_UNIVAL(name));
+               zval_dtor(&name);
                RETURN_FALSE;
        }
+       zval_dtor(&name);
 
        if (_prepped_callback) {
                rl_callback_handler_remove();
index 1cc6a3a3cef2c44ff53385e5ae83e39658be968b..571c4523b6b9b1717eddde8031adf62b7c9437ec 100644 (file)
@@ -1377,7 +1377,7 @@ PHP_FUNCTION(session_set_save_handler)
        zval **args[6];
        int i;
        ps_user *mdata;
-       char *name;
+       zval name;
 
        if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_array_ex(6, args) == FAILURE)
                WRONG_PARAM_COUNT;
@@ -1388,10 +1388,10 @@ PHP_FUNCTION(session_set_save_handler)
        for (i = 0; i < 6; i++) {
                if (!zend_is_callable(*args[i], 0, &name)) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument %d is not a valid callback", i+1);
-                       efree(name);
+                       zval_dtor(&name);
                        RETURN_FALSE;
                }
-               efree(name);
+               zval_dtor(&name);
        }
        
        zend_alter_ini_entry("session.save_handler", sizeof("session.save_handler"), "user", sizeof("user")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
index 1b0fdcc9bb0bf3a565be4b92f498374037b65d50..0dfb10d4cc3543dd666f88ad74541aaa20cb2854 100755 (executable)
@@ -371,40 +371,39 @@ PHP_FUNCTION(spl_autoload_call)
  Register given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_register)
 {
-       char *func_name = NULL, *lc_name = NULL;
+       char *func_name;
+       uint func_name_len;
+       char *lc_name = NULL;
        zval *zcallable = NULL;
-       int func_name_len;
        zend_bool do_throw = 1;
        zend_function *spl_func_ptr;
        autoload_func_info alfi;
        zval **obj_ptr;
+       zend_uchar func_name_type;
+
+       if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "|tb", &func_name, &func_name_len, &func_name_type, &do_throw) == FAILURE) {
+               zval func_name;
 
-       if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "|sb", &func_name, &func_name_len, &do_throw) == FAILURE) {
                if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|b", &zcallable, &func_name_len, &do_throw) == FAILURE) {
                        return;
                }
-               if (!zend_is_callable_ex(zcallable, 0, &func_name, &func_name_len, &alfi.func_ptr, &obj_ptr TSRMLS_CC)) {
+               if (!zend_is_callable_ex(zcallable, 0, &func_name, &alfi.func_ptr, &obj_ptr TSRMLS_CC)) {
                        if (do_throw) {
                                zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Passed array does not specify a callable static method");
                        }
-                       if (func_name) {
-                               efree(func_name);
-                       }
+                       zval_dtor(&func_name);
                        return;
                } else if (!obj_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) {
                        if (do_throw) {
                                zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Passed array specifies a non static method but no object");
                        }
-                       if (func_name) {
-                               efree(func_name);
-                       }
+                       zval_dtor(&func_name);
                        return;
                }
-               lc_name = do_alloca(func_name_len + 1);
-               zend_str_tolower_copy(lc_name, func_name, func_name_len);
-               if (func_name) {
-                       efree(func_name);
-               }
+               func_name_type = Z_TYPE(func_name);
+               func_name_len = Z_UNILEN(func_name);
+               lc_name = zend_u_str_tolower_dup(func_name_type, Z_UNIVAL(func_name), func_name_len);
+               zval_dtor(&func_name);
                if (obj_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) {
                        alfi.obj = *obj_ptr;
                        alfi.obj->refcount++;
@@ -414,22 +413,21 @@ PHP_FUNCTION(spl_autoload_register)
                        alfi.ce = NULL;
                }
        } else if (ZEND_NUM_ARGS()) {
-               lc_name = do_alloca(func_name_len + 1);
-               zend_str_tolower_copy(lc_name, func_name, func_name_len);
+               lc_name = zend_u_str_tolower_dup(func_name_type, func_name, func_name_len);
                
                if (!strcmp(lc_name, "spl_autoload_call")) {
                        if (do_throw) {
-                               zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Function spl_autoload_call() cannot be registered", func_name);
+                               zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Function spl_autoload_call() cannot be registered");
                        }
-                       free_alloca(lc_name);
+                       efree(lc_name);
                        return;
                }
 
-               if (zend_hash_find(EG(function_table), lc_name, func_name_len+1, (void **) &alfi.func_ptr) == FAILURE) {
+               if (zend_u_hash_find(EG(function_table), func_name_type, lc_name, func_name_len+1, (void **) &alfi.func_ptr) == FAILURE) {
                        if (do_throw) {
-                               zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Function '%s' not found", func_name);
+                               zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Function '%R' not found", func_name_type, func_name);
                        }
-                       free_alloca(lc_name);
+                       efree(lc_name);
                        return;
                }
                alfi.obj = NULL;
@@ -439,7 +437,7 @@ PHP_FUNCTION(spl_autoload_register)
        if (ZEND_NUM_ARGS()) {
                if (!SPL_G(autoload_functions)) {
                        ALLOC_HASHTABLE(SPL_G(autoload_functions));
-                       zend_hash_init(SPL_G(autoload_functions), 1, NULL, (dtor_func_t) autoload_func_info_dtor, 0);
+                       zend_u_hash_init(SPL_G(autoload_functions), 1, NULL, (dtor_func_t) autoload_func_info_dtor, 0, UG(unicode));
                }
 
                zend_hash_find(EG(function_table), "spl_autoload", sizeof("spl_autoload"), (void **) &spl_func_ptr);
@@ -449,9 +447,9 @@ PHP_FUNCTION(spl_autoload_register)
                        zend_hash_add(SPL_G(autoload_functions), "spl_autoload", sizeof("spl_autoload"), &spl_alfi, sizeof(autoload_func_info), NULL);
                }
 
-               zend_hash_add(SPL_G(autoload_functions), lc_name, func_name_len+1, &alfi, sizeof(autoload_func_info), NULL);
+               zend_u_hash_add(SPL_G(autoload_functions), func_name_type, lc_name, func_name_len+1, &alfi, sizeof(autoload_func_info), NULL);
 
-               free_alloca(lc_name);
+               efree(lc_name);
        }
 
        if (SPL_G(autoload_functions)) {
@@ -468,13 +466,13 @@ PHP_FUNCTION(spl_autoload_unregister)
        char *func_name, *lc_name;
        int func_name_len, success = FAILURE;
        zend_function *spl_func_ptr;
+       zend_uchar func_name_type;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &func_name, &func_name_len) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t", &func_name, &func_name_len, &func_name_type) == FAILURE) {
                return;
        }
 
-       lc_name = do_alloca(func_name_len + 1);
-       zend_str_tolower_copy(lc_name, func_name, func_name_len);
+       lc_name = zend_u_str_tolower_dup(func_name_type, func_name, func_name_len);
 
        if (SPL_G(autoload_functions)) {
                if (!strcmp(lc_name, "spl_autoload_call")) {
@@ -486,7 +484,7 @@ PHP_FUNCTION(spl_autoload_unregister)
                        success = SUCCESS;
                } else {
                        /* remove specific */
-                       success = zend_hash_del(SPL_G(autoload_functions), lc_name, func_name_len+1);
+                       success = zend_u_hash_del(SPL_G(autoload_functions), func_name_type, lc_name, func_name_len+1);
                }
        } else if (!strcmp(lc_name, "spl_autoload")) {
                /* register single spl_autoload() */
@@ -498,7 +496,7 @@ PHP_FUNCTION(spl_autoload_unregister)
                }
        }
 
-       free_alloca(lc_name);
+       efree(lc_name);
        
        RETURN_BOOL(success == SUCCESS);
 } /* }}} */
index 56e4f1f9c3c6ba2fc0f5f2c702325f6143c2bd2e..3f3e38652148fa439e3ea8db3bbb53d00d9ed372 100755 (executable)
@@ -672,9 +672,9 @@ int spl_dual_it_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
 
        intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
 
-       ZVAL_STRING(&func, method, 0);
+       ZVAL_TEXT(&func, method, 0);
        if (!zend_is_callable(&func, 0, &method)) {
-               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Method %s::%s() does not exist", intern->inner.ce->name, method);
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Method %v::%R() does not exist", intern->inner.ce->name, Z_TYPE(method), Z_UNIVAL(method));
                return FAILURE;
        }
 
index 2395d9909cf789c0d215638a9e8b454c756c2771..bbd0ccfe8b08c7865ada84ce9eba8c865a54cf87 100644 (file)
@@ -430,7 +430,8 @@ static void php_sqlite_generic_function_callback(sqlite_func *func, int argc, co
        zval ***zargs = NULL;
        zval funcname;
        int i, res;
-       char *callable = NULL, *errbuf=NULL;
+       zval callable;
+       char *errbuf=NULL;
        TSRMLS_FETCH();
 
        /* sanity check the args */
@@ -442,10 +443,10 @@ static void php_sqlite_generic_function_callback(sqlite_func *func, int argc, co
        ZVAL_STRING(&funcname, (char*)argv[0], 1);
 
        if (!zend_make_callable(&funcname, &callable TSRMLS_CC)) {
-               spprintf(&errbuf, 0, "function `%s' is not a function name", callable);
+               spprintf(&errbuf, 0, "function `%R' is not a function name", Z_TYPE(callable), Z_UNIVAL(callable));
                sqlite_set_result_error(func, errbuf, -1);
                efree(errbuf);
-               efree(callable);
+               zval_dtor(&callable);
                zval_dtor(&funcname);
                return;
        }
@@ -492,12 +493,12 @@ static void php_sqlite_generic_function_callback(sqlite_func *func, int argc, co
                }
        } else {
                char *errbuf;
-               spprintf(&errbuf, 0, "call_user_function_ex failed for function %s()", callable);
+               spprintf(&errbuf, 0, "call_user_function_ex failed for function %R()", Z_TYPE(callable), Z_UNIVAL(callable));
                sqlite_set_result_error(func, errbuf, -1);
                efree(errbuf);
        }
 
-       efree(callable);
+       zval_dtor(&callable);
 
        if (retval) {
                zval_ptr_dtor(&retval);
@@ -3000,7 +3001,7 @@ PHP_FUNCTION(sqlite_create_aggregate)
        zval *zstep, *zfinal, *zdb;
        struct php_sqlite_db *db;
        struct php_sqlite_agg_functions *funcs;
-       char *callable = NULL;
+       zval callable;
        long num_args = -1;
        zval *object = getThis();
 
@@ -3017,18 +3018,18 @@ PHP_FUNCTION(sqlite_create_aggregate)
        }
 
        if (!zend_is_callable(zstep, 0, &callable)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "step function `%s' is not callable", callable);
-               efree(callable);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "step function `%R' is not callable", Z_TYPE(callable), Z_UNIVAL(callable));
+               zval_dtor(&callable);
                return;
        }
-       efree(callable);
+       zval_dtor(&callable);
        
        if (!zend_is_callable(zfinal, 0, &callable)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "finalize function `%s' is not callable", callable);
-               efree(callable);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "finalize function `%R' is not callable", Z_TYPE(callable), Z_UNIVAL(callable));
+               zval_dtor(&callable);
                return;
        }
-       efree(callable);
+       zval_dtor(&callable);
 
        
        if (prep_callback_struct(db, 1, funcname, zstep, zfinal, &funcs) == DO_REG) {
@@ -3050,7 +3051,7 @@ PHP_FUNCTION(sqlite_create_function)
        zval *zcall, *zdb;
        struct php_sqlite_db *db;
        struct php_sqlite_agg_functions *funcs;
-       char *callable = NULL;
+       zval callable;
        long num_args = -1;
        
        zval *object = getThis();
@@ -3068,11 +3069,11 @@ PHP_FUNCTION(sqlite_create_function)
        }
 
        if (!zend_is_callable(zcall, 0, &callable)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "function `%s' is not callable", callable);
-               efree(callable);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "function `%R' is not callable", Z_TYPE(callable), Z_UNIVAL(callable));
+               zval_dtor(&callable);
                return;
        }
-       efree(callable);
+       zval_dtor(&callable);
        
        if (prep_callback_struct(db, 0, funcname, zcall, NULL, &funcs) == DO_REG) {
                sqlite_create_function(db->db, funcname, num_args, php_sqlite_function_callback, funcs);
index 10a2f8955e372f1d0999e5137e7e311340f32b23..10e181c29114a1ddc0614a0f0dd213d05915d7af 100644 (file)
@@ -1139,18 +1139,18 @@ static int php_array_walk(HashTable *target_hash, zval **userdata, int recursive
                                        zval_ptr_dtor(&retval_ptr);
                                }
                        } else {
-                               char *func_name;
+                               zval func_name;
 
                                if (zend_is_callable(*BG(array_walk_func_name), 0, &func_name)) {
-                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", func_name);
+                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %R()", Z_TYPE(func_name), Z_UNIVAL(func_name));
                                } else {
-                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s() - function does not exist", func_name);
+                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %R() - function does not exist", Z_TYPE(func_name), Z_UNIVAL(func_name));
                                }
                                if (key) {
                                        zval_ptr_dtor(&key);
                                        key = NULL;
                                }
-                               efree(func_name);
+                               zval_dtor(&func_name);
                                break;
                        }
                }
@@ -3127,7 +3127,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
        int argc, arr_argc, i, c = 0;
        Bucket ***lists, **list, ***ptrs, *p;
        
-       char *callback_name;
+       zval callback_name;
        PHP_ARRAY_CMP_FUNC_VARS;
 
        
@@ -3165,12 +3165,12 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
                        arr_argc = argc - 1;
                        intersect_data_compare_func = array_user_compare;
                        if (!zend_is_callable(*args[arr_argc], 0, &callback_name)) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %s", callback_name);
-                               efree(callback_name);
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %R", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
+                               zval_dtor(&callback_name);
                                efree(args);
                                return;
                        }
-                       efree(callback_name);
+                       zval_dtor(&callback_name);
 
                        BG(user_compare_func_name) = args[arr_argc];
                } else {
@@ -3206,12 +3206,12 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
                        }
                        arr_argc = argc - 1;
                        if (!zend_is_callable(*args[arr_argc], 0, &callback_name)) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %s", callback_name);
-                               efree(callback_name);
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %R", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
+                               zval_dtor(&callback_name);
                                efree(args);
                                return;
                        }
-                       efree(callback_name);
+                       zval_dtor(&callback_name);
                        intersect_key_compare_func = array_key_compare;
                        intersect_data_compare_func = array_user_compare;
                } else if (data_compare_type == INTERSECT_COMP_DATA_INTERNAL
@@ -3225,12 +3225,12 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
                                }
                                arr_argc = argc - 1;
                                if (!zend_is_callable(*args[arr_argc], 0, &callback_name)) {
-                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %s", callback_name);
-                                       efree(callback_name);
+                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %R", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
+                                       zval_dtor(&callback_name);
                                        efree(args);
                                        return;
                                }
-                               efree(callback_name);
+                               zval_dtor(&callback_name);
                                intersect_key_compare_func = array_user_key_compare;
                                intersect_data_compare_func = array_data_compare;
                                BG(user_compare_func_name) = args[arr_argc];
@@ -3245,19 +3245,19 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
                                }
                                arr_argc = argc - 2;
                                if (!zend_is_callable(*args[arr_argc], 0, &callback_name)) {
-                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %s", callback_name);
-                                       efree(callback_name);
+                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %R", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
+                                       zval_dtor(&callback_name);
                                        efree(args);
                                        return;
                                } 
-                               efree(callback_name);
+                               zval_dtor(&callback_name);
                                if (!zend_is_callable(*args[arr_argc + 1], 0, &callback_name)) {
-                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %s", callback_name);
-                                       efree(callback_name);
+                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %R", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
+                                       zval_dtor(&callback_name);
                                        efree(args);
                                        return;
                                }
-                               efree(callback_name);
+                               zval_dtor(&callback_name);
                                intersect_key_compare_func = array_user_key_compare;
                                intersect_data_compare_func = array_user_compare;
                                BG(user_compare_func_name) = args[arr_argc + 1];/* data - key */
@@ -3511,7 +3511,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
        HashTable *hash;
        int argc, arr_argc, i, c;
        Bucket ***lists, **list, ***ptrs, *p;
-       char *callback_name;
+       zval callback_name;
        
        PHP_ARRAY_CMP_FUNC_VARS;
 
@@ -3550,12 +3550,12 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
                        arr_argc = argc - 1;
                        diff_data_compare_func = array_user_compare;
                        if (!zend_is_callable(*args[arr_argc], 0, &callback_name)) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %s", callback_name);
-                               efree(callback_name);
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %R", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
+                               zval_dtor(&callback_name);
                                efree(args);
                                return;
                        }
-                       efree(callback_name);
+                       zval_dtor(&callback_name);
 
                        BG(user_compare_func_name) = args[arr_argc];
                } else {
@@ -3591,12 +3591,12 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
                        }
                        arr_argc = argc - 1;
                        if (!zend_is_callable(*args[arr_argc], 0, &callback_name)) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %s", callback_name);
-                               efree(callback_name);
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %R", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
+                               zval_dtor(&callback_name);
                                efree(args);
                                return;
                        }
-                       efree(callback_name);
+                       zval_dtor(&callback_name);
                        diff_key_compare_func = array_key_compare;
                        diff_data_compare_func = array_user_compare;
                } else if (data_compare_type == DIFF_COMP_DATA_INTERNAL 
@@ -3610,12 +3610,12 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
                        }
                        arr_argc = argc - 1;
                        if (!zend_is_callable(*args[arr_argc], 0, &callback_name)) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %s", callback_name);
-                               efree(callback_name);
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %R", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
+                               zval_dtor(&callback_name);
                                efree(args);
                                return;
                        }
-                       efree(callback_name);
+                       zval_dtor(&callback_name);
                        diff_key_compare_func = array_user_key_compare;
                        diff_data_compare_func = array_data_compare;
                        BG(user_compare_func_name) = args[arr_argc];
@@ -3630,19 +3630,19 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
                        }
                        arr_argc = argc - 2;
                        if (!zend_is_callable(*args[arr_argc], 0, &callback_name)) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %s", callback_name);
-                               efree(callback_name);
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %R", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
+                               zval_dtor(&callback_name);
                                efree(args);
                                return;
                        }
-                       efree(callback_name);
+                       zval_dtor(&callback_name);
                        if (!zend_is_callable(*args[arr_argc + 1], 0, &callback_name)) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %s", callback_name);
-                               efree(callback_name);
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %R", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
+                               zval_dtor(&callback_name);
                                efree(args);
                                return;
                        }
-                       efree(callback_name);
+                       zval_dtor(&callback_name);
                        diff_key_compare_func = array_user_key_compare;
                        diff_data_compare_func = array_user_compare;
                        BG(user_compare_func_name) = args[arr_argc + 1];/* data - key*/
@@ -4294,7 +4294,7 @@ PHP_FUNCTION(array_reduce)
        zval *result = NULL;
        zval *retval;
        zend_fcall_info_cache fci_cache = empty_fcall_info_cache;
-       char *callback_name;
+       zval callback_name;
        HashPosition pos;
        HashTable *htbl;
        
@@ -4309,11 +4309,11 @@ PHP_FUNCTION(array_reduce)
        }
 
        if (!zend_is_callable(*callback, 0, &callback_name)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "The second argument, '%s', should be a valid callback", callback_name);
-               efree(callback_name);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "The second argument, '%R', should be a valid callback", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
+               zval_dtor(&callback_name);
                return;
        }
-       efree(callback_name);
+       zval_dtor(&callback_name);
 
        if (ZEND_NUM_ARGS() > 2) {
                ALLOC_ZVAL(result);
@@ -4385,7 +4385,7 @@ PHP_FUNCTION(array_filter)
        zval **operand;
        zval **args[1];
        zval *retval = NULL;
-       char *callback_name;
+       zval callback_name;
        char *string_key;
        zend_fcall_info_cache fci_cache = empty_fcall_info_cache;
        uint string_key_len;
@@ -4404,11 +4404,11 @@ PHP_FUNCTION(array_filter)
 
        if (ZEND_NUM_ARGS() > 1) {
                if (!zend_is_callable(*callback, 0, &callback_name)) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "The second argument, '%s', should be a valid callback", callback_name);
-                       efree(callback_name);
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "The second argument, '%R', should be a valid callback", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
+                       zval_dtor(&callback_name);
                        return;
                }
-               efree(callback_name);
+               zval_dtor(&callback_name);
        }
 
        array_init(return_value);
@@ -4484,7 +4484,7 @@ PHP_FUNCTION(array_map)
        zval *result, *null;
        HashPosition *array_pos;
        zval **args;
-       char *callback_name;
+       zval callback_name;
        zend_fcall_info_cache fci_cache = empty_fcall_info_cache;
        int i, k, maxlen = 0;
        int *array_len;
@@ -4505,12 +4505,12 @@ PHP_FUNCTION(array_map)
 
        if (Z_TYPE_P(callback) != IS_NULL) {
                if (!zend_is_callable(callback, 0, &callback_name)) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument, '%s', should be either NULL or a valid callback", callback_name);
-                       efree(callback_name);
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument, '%R', should be either NULL or a valid callback", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
+                       zval_dtor(&callback_name);
                        efree(pargs);
                        return;
                }
-               efree(callback_name);
+               zval_dtor(&callback_name);
        }
 
        args = (zval **)safe_emalloc(ZEND_NUM_ARGS(), sizeof(zval *), 0);
index e758b2d3e3e31887f94d3934d55c457aea352817..f4f59c6d56443006260b23b6bafd5a19650664d6 100644 (file)
@@ -2029,7 +2029,7 @@ PHP_FUNCTION(call_user_func)
 {
        zval ***params;
        zval *retval_ptr;
-       char *name;
+       zval name;
        int argc = ZEND_NUM_ARGS();
 
        if (argc < 1) {
@@ -2051,8 +2051,9 @@ PHP_FUNCTION(call_user_func)
        }
 
        if (!zend_is_callable(*params[0], IS_CALLABLE_CHECK_NO_ACCESS, &name)) {
-               php_error_docref1(NULL TSRMLS_CC, name, E_WARNING, "First argument is expected to be a valid callback");
-               efree(name);
+               convert_to_string(&name);
+               php_error_docref1(NULL TSRMLS_CC, Z_STRVAL(name), E_WARNING, "First argument is expected to be a valid callback");
+               zval_dtor(&name);
                efree(params);
                RETURN_NULL();
        }
@@ -2062,22 +2063,23 @@ PHP_FUNCTION(call_user_func)
                        COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
                }
        } else {
+               convert_to_string(&name);
                if (argc > 1) {
                        SEPARATE_ZVAL(params[1]);
                        convert_to_string_ex(params[1]);
                        if (argc > 2) {
                                SEPARATE_ZVAL(params[2]);
                                convert_to_string_ex(params[2]);
-                               php_error_docref1(NULL TSRMLS_CC, name, E_WARNING, "Unable to call %s(%s,%s)", name, Z_STRVAL_PP(params[1]), Z_STRVAL_PP(params[2]));
+                               php_error_docref1(NULL TSRMLS_CC, Z_STRVAL(name), E_WARNING, "Unable to call %R(%s,%s)", Z_TYPE(name), Z_UNIVAL(name), Z_STRVAL_PP(params[1]), Z_STRVAL_PP(params[2]));
                        } else {
-                               php_error_docref1(NULL TSRMLS_CC, name, E_WARNING, "Unable to call %s(%s)", name, Z_STRVAL_PP(params[1]));
+                               php_error_docref1(NULL TSRMLS_CC, Z_STRVAL(name), E_WARNING, "Unable to call %R(%s)", Z_TYPE(name), Z_UNIVAL(name), Z_STRVAL_PP(params[1]));
                        }
                } else {
-                       php_error_docref1(NULL TSRMLS_CC, name, E_WARNING, "Unable to call %s()", name);
+                       php_error_docref1(NULL TSRMLS_CC, Z_STRVAL(name), E_WARNING, "Unable to call %R()", Z_TYPE(name), Z_UNIVAL(name));
                }
        }
 
-       efree(name);
+       zval_dtor(&name);
        efree(params);
 }
 /* }}} */
@@ -2089,7 +2091,7 @@ PHP_FUNCTION(call_user_func_array)
        zval ***func_params, **func, **params;
        zval *retval_ptr;
        HashTable *func_params_ht;
-       char *name;
+       zval name;
        int count;
        int current = 0;
 
@@ -2108,8 +2110,8 @@ PHP_FUNCTION(call_user_func_array)
        }
 
        if (!zend_is_callable(*func, IS_CALLABLE_CHECK_NO_ACCESS, &name)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "First argument is expected to be a valid callback, '%s' was given", name);
-               efree(name);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "First argument is expected to be a valid callback, '%R' was given", Z_TYPE(name), Z_UNIVAL(name));
+               zval_dtor(&name);
                RETURN_NULL();
        }
 
@@ -2134,10 +2136,10 @@ PHP_FUNCTION(call_user_func_array)
                        COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
                }
        } else {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", name);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %R()", Z_TYPE(name), Z_UNIVAL(name));
        }
 
-       efree(name);
+       zval_dtor(&name);
        if (func_params) {
                efree(func_params);
        }
@@ -2256,10 +2258,10 @@ void user_tick_function_dtor(user_tick_function_entry *tick_function_entry)
 static int user_shutdown_function_call(php_shutdown_function_entry *shutdown_function_entry TSRMLS_DC)
 {
        zval retval;
-       char *function_name = NULL;
+       zval function_name;
 
        if (!zend_is_callable(shutdown_function_entry->arguments[0], 0, &function_name)) {
-               php_error(E_WARNING, "(Registered shutdown functions) Unable to call %s() - function does not exist", function_name);
+               php_error(E_WARNING, "(Registered shutdown functions) Unable to call %R() - function does not exist", Z_TYPE(function_name), Z_UNIVAL(function_name));
        } else if (call_user_function(EG(function_table), NULL,
                                                                shutdown_function_entry->arguments[0],
                                                                &retval, 
@@ -2269,9 +2271,7 @@ static int user_shutdown_function_call(php_shutdown_function_entry *shutdown_fun
        {
                zval_dtor(&retval);
        } 
-       if (function_name) {
-               efree(function_name);
-       }
+       zval_dtor(&function_name);
        return 0;
 }
 
@@ -2363,7 +2363,7 @@ void php_free_shutdown_functions(TSRMLS_D)
 PHP_FUNCTION(register_shutdown_function)
 {
        php_shutdown_function_entry shutdown_function_entry;
-       char *function_name = NULL;
+       zval function_name;
        int i;
 
        shutdown_function_entry.arg_count = ZEND_NUM_ARGS();
@@ -2380,7 +2380,7 @@ PHP_FUNCTION(register_shutdown_function)
        
        /* Prevent entering of anything but valid callback (syntax check only!) */
        if (!zend_is_callable(shutdown_function_entry.arguments[0], 1, &function_name)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid shutdown callback '%s' passed", function_name);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid shutdown callback '%R' passed", Z_TYPE(function_name), Z_UNIVAL(function_name));
                efree(shutdown_function_entry.arguments);
                RETVAL_FALSE;
        } else {
@@ -2394,9 +2394,7 @@ PHP_FUNCTION(register_shutdown_function)
                }
                zend_hash_next_index_insert(BG(user_shutdown_function_names), &shutdown_function_entry, sizeof(php_shutdown_function_entry), NULL);
        }
-       if (function_name) {
-               efree(function_name);
-       }
+       zval_dtor(&function_name);
 }
 /* }}} */
 
index c4be0c3395b0624bff16be71c16dae30a1500432..161ce7f5f007200a61176bd30cfb93c0d7189586 100644 (file)
@@ -407,7 +407,7 @@ PHP_FUNCTION(is_scalar)
 PHP_FUNCTION(is_callable)
 {
        zval **var, **syntax_only, **callable_name;
-       char *name;
+       zval name;
        zend_bool retval;
        zend_bool syntax = 0;
        int argc=ZEND_NUM_ARGS();
@@ -424,7 +424,7 @@ PHP_FUNCTION(is_callable)
        if (argc > 2) {
                retval = zend_is_callable(*var, syntax, &name);
                zval_dtor(*callable_name);
-               ZVAL_STRING(*callable_name, name, 0);
+               **callable_name = name;
        } else {
                retval = zend_is_callable(*var, syntax, NULL);
        }
index 0442c5a6f2e63e23592c38ce717f190a6b9ad1c5..e524db7160bd3c73feb8db8b1f3b5b32bf73d447 100644 (file)
@@ -2182,7 +2182,7 @@ PHP_FUNCTION(sybase_deadlock_retry_count)
 PHP_FUNCTION(sybase_set_message_handler)
 {
        zval **callback, **param, **sybase_link_index= NULL;
-       char *name;
+       zval name;
        sybase_link *sybase_ptr;
 
        switch (ZEND_NUM_ARGS()) {
@@ -2221,11 +2221,11 @@ PHP_FUNCTION(sybase_set_message_handler)
                case IS_STRING:
                        /* Either "function", array("class", "function") or array($object, "function") */
                        if (!zend_is_callable(*param, 0, &name)) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "First argumented is expected to be a valid callback, '%s' was given", name);
-                               efree(name);
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "First argumented is expected to be a valid callback, '%R' was given", Z_TYPE(name), Z_UNIVAL(name));
+                               zval_dtor(&name);
                                RETURN_FALSE;
                        }
-                       efree(name);
+                       zval_dtor(&name);
                        break;
 
                default:
index 2e321312e89f02133a37355a20752bbad6d58318..f67af7e311883c42f7bc1c967141b6051e535890 100644 (file)
@@ -134,7 +134,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
        zval handler;
        xmlXPathObjectPtr obj;
        char *str;
-       char *callable = NULL;
+       zval callable;
        xsl_object *intern;
        
        TSRMLS_FETCH();
@@ -265,10 +265,10 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
        fci.no_separation = 0;
        /*fci.function_handler_cache = &function_ptr;*/
        if (!zend_make_callable(&handler, &callable TSRMLS_CC)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", callable);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %R()", Z_TYPE(callable), Z_UNIVAL(callable));
                
-       } else if ( intern->registerPhpFunctions == 2 && zend_hash_exists(intern->registered_phpfunctions, callable, strlen(callable) + 1) == 0) { 
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not allowed to call handler '%s()'.", callable);
+       } else if ( intern->registerPhpFunctions == 2 && zend_u_hash_exists(intern->registered_phpfunctions, Z_TYPE(callable), Z_UNIVLA(callable), Z_UNILEN(callable) + 1) == 0) { 
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not allowed to call handler '%R()'.", Z_TYPE(callable), Z_UNILEN(callable));
                // Push an empty string, so that we at least have an xslt result...
                valuePush(ctxt, xmlXPathNewString(""));
        } else {
@@ -304,7 +304,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
                        zval_ptr_dtor(&retval);
                }
        }
-       efree(callable);
+       zval_dtor(&callable);
        zval_dtor(&handler);
        if (fci.param_count > 0) {
                for (i = 0; i < nargs - 1; i++) {
index 9dc7c80a16e4afc3c23030cd5f709521e32f559c..702044282fe3353bd922ad21f3beef315224f0b7 100644 (file)
@@ -554,16 +554,16 @@ static int php_ob_init(uint initial_size, uint block_size, zval *output_handler,
                        }
                }
        } else if (output_handler && output_handler->type == IS_ARRAY) {
-               char* handler_name;
+               zval handler_name;
 
                /* do we have array(object,method) */
                if (zend_is_callable(output_handler, 0, &handler_name)) {
                        SEPARATE_ZVAL(&output_handler);
                        output_handler->refcount++;
-                       result = php_ob_init_named(initial_size, block_size, UG(unicode)?IS_UNICODE:IS_STRING, handler_name, output_handler, chunk_size, erase TSRMLS_CC);
-                       efree(handler_name);
+                       result = php_ob_init_named(initial_size, block_size, Z_TYPE(handler_name), Z_UNIVAL(handler_name), output_handler, chunk_size, erase TSRMLS_CC);
+                       zval_dtor(&handler_name);
                } else {
-                       efree(handler_name);
+                       zval_dtor(&handler_name);
                        /* init all array elements recursively */
                        zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(output_handler), &pos);
                        while (zend_hash_get_current_data_ex(Z_ARRVAL_P(output_handler), (void **)&tmp, &pos) == SUCCESS) {
index eb710052d0ebbbbb4f9ea2d8c13391d4025ae429..62fa9ab3211cd74cb8b51e9232fef25f7dc3d77e 100644 (file)
@@ -18,3 +18,51 @@ ext/standard
         trim()
         ucwords()
         ucfirst()
+ZE
+--
+  Status: In Progress
+        debug_backtrace()
+        extension_loaded()
+        get_extension_funcs()
+        get_included_files()
+                               strcasecmp()
+        strncasecmp()
+  Completed:
+        class_exists()
+        create_function()
+        debug_print_backtrace()
+        define()
+        defined()
+        each()
+        error_reporting()
+        func_get_arg()
+        func_get_args()
+        func_num_args()
+        function_exists()
+        get_class()
+        get_class_methods()
+        get_class_vars()
+        get_declared_classes()
+        get_declared_interfaces()
+        get_defined_constants()
+        get_defined_functions()
+        get_defined_vars()
+        get_loaded_extensions()
+        get_object_vars()
+        get_parent_class()
+        get_resource_type()
+        interface_exists()
+        is_a()
+        is_subclass_of()
+        method_exists()
+        property_exists()
+        restore_error_handler()
+        restore_exception_handler()
+        set_error_handler()
+        set_exception_handler()
+        strcmp()
+        strlen()
+        strncmp()
+        trigger_error()
+        zend_thread_id()
+        zend_version()