cvs: php-src / unicode-progress.txt /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 spl_iterators.c /ext/sqlite
sqlite.c /ext/standard array.c basic_functions.c type.c /ext/sybase_ct php_sybase_ct.c /ext/xsl xsltprocessor.c /main output.c ZendEngine2
zend_API.c zend_API.h zend_builtin_functions.c zend_execute_API.c
| From: | Dmitry Stogov | Date: | Mon, 22 Aug 2005 12:22:18 +0000 |
| Subject: | cvs: php-src / unicode-progress.txt /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 spl_iterators.c /ext/sqlite sqlite.c /ext/standard array.c basic_functions.c type.c /ext/sybase_ct php_sybase_ct.c /ext/xsl xsltprocessor.c /main output.c ZendEngine2 zend_API.c zend_API.h zend_builtin_functions.c zend_execute_API.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-33577@lists.php.net to get a copy of this message | ||
dmitry Mon Aug 22 08:22:18 2005 EDT
Modified files:
/php-src unicode-progress.txt
/ZendEngine2 zend_API.c zend_API.h zend_builtin_functions.c
zend_execute_API.c
/php-src/ext/fdf fdf.c
/php-src/ext/ldap ldap.c
/php-src/ext/mysqli mysqli_api.c
/php-src/ext/pcntl pcntl.c
/php-src/ext/pcre php_pcre.c
/php-src/ext/pdo pdo_stmt.c
/php-src/ext/pdo_sqlite sqlite_driver.c
/php-src/ext/readline readline.c
/php-src/ext/session session.c
/php-src/ext/spl php_spl.c spl_iterators.c
/php-src/ext/sqlite sqlite.c
/php-src/ext/standard array.c basic_functions.c type.c
/php-src/ext/sybase_ct php_sybase_ct.c
/php-src/ext/xsl xsltprocessor.c
/php-src/main output.c
Log:
zend_is_callable() and zend_make_callable() were changed to return readable function name as zval
(instead of string).
http://cvs.php.net/diff.php/php-src/unicode-progress.txt?r1=1.3&r2=1.4&ty=u Index: php-src/unicode-progress.txt diff -u php-src/unicode-progress.txt:1.3 php-src/unicode-progress.txt:1.4 --- php-src/unicode-progress.txt:1.3 Fri Aug 19 18:58:40 2005 +++ php-src/unicode-progress.txt Mon Aug 22 08:22:04 2005 @@ -18,3 +18,51 @@ 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() http://cvs.php.net/diff.php/ZendEngine2/zend_API.c?r1=1.310&r2=1.311&ty=u Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.310 ZendEngine2/zend_API.c:1.311 --- ZendEngine2/zend_API.c:1.310 Fri Aug 19 18:33:39 2005 +++ ZendEngine2/zend_API.c Mon Aug 22 08:22:07 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.310 2005/08/19 22:33:39 andrei Exp $ */ +/* $Id: zend_API.c,v 1.311 2005/08/22 12:22:07 dmitry Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -2399,18 +2399,14 @@ 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 @@ 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 @@ if (Z_TYPE_PP(obj) == IS_STRING || Z_TYPE_PP(obj) == IS_UNICODE) { if (callable_name) { - char *ptr; + 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, ©, &use_copy); + memcpy(Z_USTRVAL_P(callable_name), Z_USTRVAL(copy), UBYTES(Z_USTRLEN(copy))); + zval_dtor(©); + } + 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, ©, &use_copy); + memcpy(Z_USTRVAL_P(callable_name)+Z_UNILEN_PP(obj)+2, Z_USTRVAL(copy), UBYTES(Z_USTRLEN(copy)+1)); + zval_dtor(©); + } + } 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, ©, &use_copy); + memcpy(Z_STRVAL_P(callable_name), Z_STRVAL(copy), Z_STRLEN(copy)); + zval_dtor(©); + } + 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; - *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); + zend_make_string_zval(*method, ©, &use_copy); + memcpy(Z_STRVAL_P(callable_name)+Z_UNILEN_PP(obj)+2, Z_STRVAL(copy), Z_STRLEN(copy)+1); + zval_dtor(©); + } + } } if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) @@ -2495,15 +2531,41 @@ *zobj_ptr_ptr = obj; if (callable_name) { - char *ptr; + 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; - *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); + zend_make_unicode_zval(*method, ©, &use_copy); + memcpy(Z_USTRVAL_P(callable_name)+ce->name_length+2, Z_USTRVAL(copy), UBYTES(Z_USTRLEN(copy)+1)); + zval_dtor(©); + } + } 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, ©, &use_copy); + memcpy(Z_STRVAL_P(callable_name)+ce->name_length+2, Z_STRVAL(copy), Z_STRLEN(copy)+1); + zval_dtor(©); + } + } } if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) @@ -2542,21 +2604,16 @@ 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(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_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_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; http://cvs.php.net/diff.php/ZendEngine2/zend_API.h?r1=1.216&r2=1.217&ty=u Index: ZendEngine2/zend_API.h diff -u ZendEngine2/zend_API.h:1.216 ZendEngine2/zend_API.h:1.217 --- ZendEngine2/zend_API.h:1.216 Fri Aug 19 18:33:39 2005 +++ ZendEngine2/zend_API.h Mon Aug 22 08:22:07 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.h,v 1.216 2005/08/19 22:33:39 andrei Exp $ */ +/* $Id: zend_API.h,v 1.217 2005/08/22 12:22:07 dmitry Exp $ */ #ifndef ZEND_API_H #define ZEND_API_H @@ -203,9 +203,9 @@ #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_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); http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.c?r1=1.285&r2=1.286&ty=u Index: ZendEngine2/zend_builtin_functions.c diff -u ZendEngine2/zend_builtin_functions.c:1.285 ZendEngine2/zend_builtin_functions.c:1.286 --- ZendEngine2/zend_builtin_functions.c:1.285 Fri Aug 19 19:15:36 2005 +++ ZendEngine2/zend_builtin_functions.c Mon Aug 22 08:22:07 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_builtin_functions.c,v 1.285 2005/08/19 23:15:36 andrei Exp $ */ +/* $Id: zend_builtin_functions.c,v 1.286 2005/08/22 12:22:07 dmitry Exp $ */ #include "zend.h" #include "zend_API.h" @@ -1202,7 +1202,7 @@ { 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 @@ } 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(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 @@ 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)) { http://cvs.php.net/diff.php/ZendEngine2/zend_execute_API.c?r1=1.337&r2=1.338&ty=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.337 ZendEngine2/zend_execute_API.c:1.338 --- ZendEngine2/zend_execute_API.c:1.337 Mon Aug 22 02:56:26 2005 +++ ZendEngine2/zend_execute_API.c Mon Aug 22 08:22:08 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.337 2005/08/22 06:56:26 dmitry Exp $ */ +/* $Id: zend_execute_API.c,v 1.338 2005/08/22 12:22:08 dmitry Exp $ */ #include <stdio.h> #include <signal.h> @@ -799,6 +799,11 @@ 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 @@ 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 @@ 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); http://cvs.php.net/diff.php/php-src/ext/fdf/fdf.c?r1=1.89&r2=1.90&ty=u Index: php-src/ext/fdf/fdf.c diff -u php-src/ext/fdf/fdf.c:1.89 php-src/ext/fdf/fdf.c:1.90 --- php-src/ext/fdf/fdf.c:1.89 Wed Aug 3 10:07:09 2005 +++ php-src/ext/fdf/fdf.c Mon Aug 22 08:22:08 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fdf.c,v 1.89 2005/08/03 14:07:09 sniper Exp $ */ +/* $Id: fdf.c,v 1.90 2005/08/22 12:22:08 dmitry Exp $ */ /* FdfTk lib 2.0 is a Complete C/C++ FDF Toolkit available from http://beta1.adobe.com/ada/acrosdk/forms.html. */ @@ -1573,7 +1573,7 @@ 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 @@ 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; http://cvs.php.net/diff.php/php-src/ext/ldap/ldap.c?r1=1.161&r2=1.162&ty=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.161 php-src/ext/ldap/ldap.c:1.162 --- php-src/ext/ldap/ldap.c:1.161 Wed Aug 3 10:07:22 2005 +++ php-src/ext/ldap/ldap.c Mon Aug 22 08:22:08 2005 @@ -22,7 +22,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ldap.c,v 1.161 2005/08/03 14:07:22 sniper Exp $ */ +/* $Id: ldap.c,v 1.162 2005/08/22 12:22:08 dmitry Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -314,7 +314,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.161 2005/08/03 14:07:22 sniper Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.162 2005/08/22 12:22:08 dmitry Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -2199,7 +2199,7 @@ { 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 @@ /* 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) { http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.118&r2=1.119&ty=u Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.118 php-src/ext/mysqli/mysqli_api.c:1.119 --- php-src/ext/mysqli/mysqli_api.c:1.118 Wed Aug 3 10:07:30 2005 +++ php-src/ext/mysqli/mysqli_api.c Mon Aug 22 08:22:09 2005 @@ -15,7 +15,7 @@ | Author: Georg Richter <georg@php.net> | +----------------------------------------------------------------------+ - $Id: mysqli_api.c,v 1.118 2005/08/03 14:07:30 sniper Exp $ + $Id: mysqli_api.c,v 1.119 2005/08/22 12:22:09 dmitry Exp $ */ #ifdef HAVE_CONFIG_H @@ -1105,7 +1105,7 @@ { 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 @@ /* 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); http://cvs.php.net/diff.php/php-src/ext/pcntl/pcntl.c?r1=1.48&r2=1.49&ty=u Index: php-src/ext/pcntl/pcntl.c diff -u php-src/ext/pcntl/pcntl.c:1.48 php-src/ext/pcntl/pcntl.c:1.49 --- php-src/ext/pcntl/pcntl.c:1.48 Wed Aug 3 10:07:37 2005 +++ php-src/ext/pcntl/pcntl.c Mon Aug 22 08:22:10 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pcntl.c,v 1.48 2005/08/03 14:07:37 sniper Exp $ */ +/* $Id: pcntl.c,v 1.49 2005/08/22 12:22:10 dmitry Exp $ */ #define PCNTL_DEBUG 0 @@ -521,7 +521,7 @@ 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 @@ } 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); http://cvs.php.net/diff.php/php-src/ext/pcre/php_pcre.c?r1=1.169&r2=1.170&ty=u Index: php-src/ext/pcre/php_pcre.c diff -u php-src/ext/pcre/php_pcre.c:1.169 php-src/ext/pcre/php_pcre.c:1.170 --- php-src/ext/pcre/php_pcre.c:1.169 Thu Aug 18 09:34:00 2005 +++ php-src/ext/pcre/php_pcre.c Mon Aug 22 08:22:10 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pcre.c,v 1.169 2005/08/18 13:34:00 sniper Exp $ */ +/* $Id: php_pcre.c,v 1.170 2005/08/22 12:22:10 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1128,7 +1128,7 @@ 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 @@ 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); http://cvs.php.net/diff.php/php-src/ext/pdo/pdo_stmt.c?r1=1.122&r2=1.123&ty=u Index: php-src/ext/pdo/pdo_stmt.c diff -u php-src/ext/pdo/pdo_stmt.c:1.122 php-src/ext/pdo/pdo_stmt.c:1.123 --- php-src/ext/pdo/pdo_stmt.c:1.122 Tue Aug 16 15:43:23 2005 +++ php-src/ext/pdo/pdo_stmt.c Mon Aug 22 08:22:11 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdo_stmt.c,v 1.122 2005/08/16 19:43:23 andrei Exp $ */ +/* $Id: pdo_stmt.c,v 1.123 2005/08/22 12:22:11 dmitry Exp $ */ /* The PDO Statement Handle Class */ @@ -632,7 +632,6 @@ 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 @@ 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 @@ 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; http://cvs.php.net/diff.php/php-src/ext/pdo_sqlite/sqlite_driver.c?r1=1.21&r2=1.22&ty=u Index: php-src/ext/pdo_sqlite/sqlite_driver.c diff -u php-src/ext/pdo_sqlite/sqlite_driver.c:1.21 php-src/ext/pdo_sqlite/sqlite_driver.c:1.22 --- php-src/ext/pdo_sqlite/sqlite_driver.c:1.21 Fri Aug 12 19:32:31 2005 +++ php-src/ext/pdo_sqlite/sqlite_driver.c Mon Aug 22 08:22:11 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sqlite_driver.c,v 1.21 2005/08/12 23:32:31 wez Exp $ */ +/* $Id: sqlite_driver.c,v 1.22 2005/08/22 12:22:11 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -457,7 +457,7 @@ 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 @@ 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 @@ 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 @@ 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; http://cvs.php.net/diff.php/php-src/ext/readline/readline.c?r1=1.42&r2=1.43&ty=u Index: php-src/ext/readline/readline.c diff -u php-src/ext/readline/readline.c:1.42 php-src/ext/readline/readline.c:1.43 --- php-src/ext/readline/readline.c:1.42 Wed Aug 3 10:07:42 2005 +++ php-src/ext/readline/readline.c Mon Aug 22 08:22:11 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: readline.c,v 1.42 2005/08/03 14:07:42 sniper Exp $ */ +/* $Id: readline.c,v 1.43 2005/08/22 12:22:11 dmitry Exp $ */ /* {{{ includes & prototypes */ @@ -441,16 +441,18 @@ 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 @@ PHP_FUNCTION(readline_callback_handler_install) { zval *callback; - char *name = NULL; + zval name; char *prompt; int prompt_len; @@ -498,9 +500,11 @@ } 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(); http://cvs.php.net/diff.php/php-src/ext/session/session.c?r1=1.417&r2=1.418&ty=u Index: php-src/ext/session/session.c diff -u php-src/ext/session/session.c:1.417 php-src/ext/session/session.c:1.418 --- php-src/ext/session/session.c:1.417 Wed Aug 3 10:07:44 2005 +++ php-src/ext/session/session.c Mon Aug 22 08:22:12 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: session.c,v 1.417 2005/08/03 14:07:44 sniper Exp $ */ +/* $Id: session.c,v 1.418 2005/08/22 12:22:12 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1377,7 +1377,7 @@ 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 @@ 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); http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.58&r2=1.59&ty=u Index: php-src/ext/spl/php_spl.c diff -u php-src/ext/spl/php_spl.c:1.58 php-src/ext/spl/php_spl.c:1.59 --- php-src/ext/spl/php_spl.c:1.58 Mon Aug 15 13:29:04 2005 +++ php-src/ext/spl/php_spl.c Mon Aug 22 08:22:12 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_spl.c,v 1.58 2005/08/15 17:29:04 dmitry Exp $ */ +/* $Id: php_spl.c,v 1.59 2005/08/22 12:22:12 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -371,40 +371,39 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ } } - free_alloca(lc_name); + efree(lc_name); RETURN_BOOL(success == SUCCESS); } /* }}} */ http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.c?r1=1.81&r2=1.82&ty=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.81 php-src/ext/spl/spl_iterators.c:1.82 --- php-src/ext/spl/spl_iterators.c:1.81 Mon Aug 15 15:16:30 2005 +++ php-src/ext/spl/spl_iterators.c Mon Aug 22 08:22:12 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_iterators.c,v 1.81 2005/08/15 19:16:30 helly Exp $ */ +/* $Id: spl_iterators.c,v 1.82 2005/08/22 12:22:12 dmitry Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -672,9 +672,9 @@ 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; } http://cvs.php.net/diff.php/php-src/ext/sqlite/sqlite.c?r1=1.169&r2=1.170&ty=u Index: php-src/ext/sqlite/sqlite.c diff -u php-src/ext/sqlite/sqlite.c:1.169 php-src/ext/sqlite/sqlite.c:1.170 --- php-src/ext/sqlite/sqlite.c:1.169 Tue Aug 16 11:09:47 2005 +++ php-src/ext/sqlite/sqlite.c Mon Aug 22 08:22:13 2005 @@ -17,7 +17,7 @@ | Marcus Boerger <helly@php.net> | +----------------------------------------------------------------------+ - $Id: sqlite.c,v 1.169 2005/08/16 15:09:47 dmitry Exp $ + $Id: sqlite.c,v 1.170 2005/08/22 12:22:13 dmitry Exp $ */ #ifdef HAVE_CONFIG_H @@ -430,7 +430,8 @@ 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 @@ 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 @@ } } 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); @@ -1125,7 +1126,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, "SQLite support", "enabled"); - php_info_print_table_row(2, "PECL Module version", PHP_SQLITE_MODULE_VERSION " $Id: sqlite.c,v 1.169 2005/08/16 15:09:47 dmitry Exp $"); + php_info_print_table_row(2, "PECL Module version", PHP_SQLITE_MODULE_VERSION " $Id: sqlite.c,v 1.170 2005/08/22 12:22:13 dmitry Exp $"); php_info_print_table_row(2, "SQLite Library", sqlite_libversion()); php_info_print_table_row(2, "SQLite Encoding", sqlite_libencoding()); php_info_print_table_end(); @@ -3000,7 +3001,7 @@ 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 @@ } 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 @@ 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 @@ } 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); http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.320&r2=1.321&ty=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.320 php-src/ext/standard/array.c:1.321 --- php-src/ext/standard/array.c:1.320 Fri Aug 19 03:49:41 2005 +++ php-src/ext/standard/array.c Mon Aug 22 08:22:13 2005 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.320 2005/08/19 07:49:41 dmitry Exp $ */ +/* $Id: array.c,v 1.321 2005/08/22 12:22:13 dmitry Exp $ */ #include "php.h" #include "php_ini.h" @@ -1139,18 +1139,18 @@ 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 @@ 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 @@ 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 @@ } 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 @@ } 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 @@ } 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 @@ 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 @@ 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 @@ } 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 @@ } 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 @@ } 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 @@ 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 @@ } 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 @@ 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 @@ 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 @@ 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 @@ 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); http://cvs.php.net/diff.php/php-src/ext/standard/basic_functions.c?r1=1.729&r2=1.730&ty=u Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.729 php-src/ext/standard/basic_functions.c:1.730 --- php-src/ext/standard/basic_functions.c:1.729 Sat Aug 13 06:16:04 2005 +++ php-src/ext/standard/basic_functions.c Mon Aug 22 08:22:14 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.729 2005/08/13 10:16:04 helly Exp $ */ +/* $Id: basic_functions.c,v 1.730 2005/08/22 12:22:14 dmitry Exp $ */ #include "php.h" #include "php_streams.h" @@ -2029,7 +2029,7 @@ { zval ***params; zval *retval_ptr; - char *name; + zval name; int argc = ZEND_NUM_ARGS(); if (argc < 1) { @@ -2051,8 +2051,9 @@ } 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 @@ 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 @@ 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 @@ } 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 @@ 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 @@ 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 @@ { zval_dtor(&retval); } - if (function_name) { - efree(function_name); - } + zval_dtor(&function_name); return 0; } @@ -2363,7 +2363,7 @@ 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 @@ /* 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 @@ } 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); } /* }}} */ http://cvs.php.net/diff.php/php-src/ext/standard/type.c?r1=1.34&r2=1.35&ty=u Index: php-src/ext/standard/type.c diff -u php-src/ext/standard/type.c:1.34 php-src/ext/standard/type.c:1.35 --- php-src/ext/standard/type.c:1.34 Sat Aug 13 17:18:47 2005 +++ php-src/ext/standard/type.c Mon Aug 22 08:22:15 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: type.c,v 1.34 2005/08/13 21:18:47 helly Exp $ */ +/* $Id: type.c,v 1.35 2005/08/22 12:22:15 dmitry Exp $ */ #include "php.h" #include "php_incomplete_class.h" @@ -407,7 +407,7 @@ 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 @@ 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); } http://cvs.php.net/diff.php/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.104&r2=1.105&ty=u Index: php-src/ext/sybase_ct/php_sybase_ct.c diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.104 php-src/ext/sybase_ct/php_sybase_ct.c:1.105 --- php-src/ext/sybase_ct/php_sybase_ct.c:1.104 Thu Aug 18 09:34:04 2005 +++ php-src/ext/sybase_ct/php_sybase_ct.c Mon Aug 22 08:22:15 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_sybase_ct.c,v 1.104 2005/08/18 13:34:04 sniper Exp $ */ +/* $Id: php_sybase_ct.c,v 1.105 2005/08/22 12:22:15 dmitry Exp $ */ #ifdef HAVE_CONFIG_H @@ -2182,7 +2182,7 @@ 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 @@ 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: http://cvs.php.net/diff.php/php-src/ext/xsl/xsltprocessor.c?r1=1.39&r2=1.40&ty=u Index: php-src/ext/xsl/xsltprocessor.c diff -u php-src/ext/xsl/xsltprocessor.c:1.39 php-src/ext/xsl/xsltprocessor.c:1.40 --- php-src/ext/xsl/xsltprocessor.c:1.39 Wed Aug 3 10:08:23 2005 +++ php-src/ext/xsl/xsltprocessor.c Mon Aug 22 08:22:16 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xsltprocessor.c,v 1.39 2005/08/03 14:08:23 sniper Exp $ */ +/* $Id: xsltprocessor.c,v 1.40 2005/08/22 12:22:16 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -134,7 +134,7 @@ zval handler; xmlXPathObjectPtr obj; char *str; - char *callable = NULL; + zval callable; xsl_object *intern; TSRMLS_FETCH(); @@ -265,10 +265,10 @@ 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 @@ zval_ptr_dtor(&retval); } } - efree(callable); + zval_dtor(&callable); zval_dtor(&handler); if (fci.param_count > 0) { for (i = 0; i < nargs - 1; i++) { http://cvs.php.net/diff.php/php-src/main/output.c?r1=1.169&r2=1.170&ty=u Index: php-src/main/output.c diff -u php-src/main/output.c:1.169 php-src/main/output.c:1.170 --- php-src/main/output.c:1.169 Thu Aug 18 06:18:40 2005 +++ php-src/main/output.c Mon Aug 22 08:22:16 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: output.c,v 1.169 2005/08/18 10:18:40 dmitry Exp $ */ +/* $Id: output.c,v 1.170 2005/08/22 12:22:16 dmitry Exp $ */ #include "php.h" #include "ext/standard/head.h" @@ -554,16 +554,16 @@ } } } 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) {
http://cvs.php.net/diff.php/php-src/unicode-progress.txt?r1=1.3&r2=1.4&ty=u Index: php-src/unicode-progress.txt diff -u php-src/unicode-progress.txt:1.3 php-src/unicode-progress.txt:1.4 --- php-src/unicode-progress.txt:1.3 Fri Aug 19 18:58:40 2005 +++ php-src/unicode-progress.txt Mon Aug 22 08:22:04 2005 @@ -18,3 +18,51 @@ 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() http://cvs.php.net/diff.php/ZendEngine2/zend_API.c?r1=1.310&r2=1.311&ty=u Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.310 ZendEngine2/zend_API.c:1.311 --- ZendEngine2/zend_API.c:1.310 Fri Aug 19 18:33:39 2005 +++ ZendEngine2/zend_API.c Mon Aug 22 08:22:07 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.310 2005/08/19 22:33:39 andrei Exp $ */ +/* $Id: zend_API.c,v 1.311 2005/08/22 12:22:07 dmitry Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -2399,18 +2399,14 @@ 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 @@ 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 @@ if (Z_TYPE_PP(obj) == IS_STRING || Z_TYPE_PP(obj) == IS_UNICODE) { if (callable_name) { - char *ptr; + 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, ©, &use_copy); + memcpy(Z_USTRVAL_P(callable_name), Z_USTRVAL(copy), UBYTES(Z_USTRLEN(copy))); + zval_dtor(©); + } + 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, ©, &use_copy); + memcpy(Z_USTRVAL_P(callable_name)+Z_UNILEN_PP(obj)+2, Z_USTRVAL(copy), UBYTES(Z_USTRLEN(copy)+1)); + zval_dtor(©); + } + } 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, ©, &use_copy); + memcpy(Z_STRVAL_P(callable_name), Z_STRVAL(copy), Z_STRLEN(copy)); + zval_dtor(©); + } + 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; - *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); + zend_make_string_zval(*method, ©, &use_copy); + memcpy(Z_STRVAL_P(callable_name)+Z_UNILEN_PP(obj)+2, Z_STRVAL(copy), Z_STRLEN(copy)+1); + zval_dtor(©); + } + } } if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) @@ -2495,15 +2531,41 @@ *zobj_ptr_ptr = obj; if (callable_name) { - char *ptr; + 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; - *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); + zend_make_unicode_zval(*method, ©, &use_copy); + memcpy(Z_USTRVAL_P(callable_name)+ce->name_length+2, Z_USTRVAL(copy), UBYTES(Z_USTRLEN(copy)+1)); + zval_dtor(©); + } + } 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, ©, &use_copy); + memcpy(Z_STRVAL_P(callable_name)+ce->name_length+2, Z_STRVAL(copy), Z_STRLEN(copy)+1); + zval_dtor(©); + } + } } if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) @@ -2542,21 +2604,16 @@ 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(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_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_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; http://cvs.php.net/diff.php/ZendEngine2/zend_API.h?r1=1.216&r2=1.217&ty=u Index: ZendEngine2/zend_API.h diff -u ZendEngine2/zend_API.h:1.216 ZendEngine2/zend_API.h:1.217 --- ZendEngine2/zend_API.h:1.216 Fri Aug 19 18:33:39 2005 +++ ZendEngine2/zend_API.h Mon Aug 22 08:22:07 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.h,v 1.216 2005/08/19 22:33:39 andrei Exp $ */ +/* $Id: zend_API.h,v 1.217 2005/08/22 12:22:07 dmitry Exp $ */ #ifndef ZEND_API_H #define ZEND_API_H @@ -203,9 +203,9 @@ #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_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); http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.c?r1=1.285&r2=1.286&ty=u Index: ZendEngine2/zend_builtin_functions.c diff -u ZendEngine2/zend_builtin_functions.c:1.285 ZendEngine2/zend_builtin_functions.c:1.286 --- ZendEngine2/zend_builtin_functions.c:1.285 Fri Aug 19 19:15:36 2005 +++ ZendEngine2/zend_builtin_functions.c Mon Aug 22 08:22:07 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_builtin_functions.c,v 1.285 2005/08/19 23:15:36 andrei Exp $ */ +/* $Id: zend_builtin_functions.c,v 1.286 2005/08/22 12:22:07 dmitry Exp $ */ #include "zend.h" #include "zend_API.h" @@ -1202,7 +1202,7 @@ { 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 @@ } 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(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 @@ 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)) { http://cvs.php.net/diff.php/ZendEngine2/zend_execute_API.c?r1=1.337&r2=1.338&ty=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.337 ZendEngine2/zend_execute_API.c:1.338 --- ZendEngine2/zend_execute_API.c:1.337 Mon Aug 22 02:56:26 2005 +++ ZendEngine2/zend_execute_API.c Mon Aug 22 08:22:08 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.337 2005/08/22 06:56:26 dmitry Exp $ */ +/* $Id: zend_execute_API.c,v 1.338 2005/08/22 12:22:08 dmitry Exp $ */ #include <stdio.h> #include <signal.h> @@ -799,6 +799,11 @@ 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 @@ 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 @@ 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); http://cvs.php.net/diff.php/php-src/ext/fdf/fdf.c?r1=1.89&r2=1.90&ty=u Index: php-src/ext/fdf/fdf.c diff -u php-src/ext/fdf/fdf.c:1.89 php-src/ext/fdf/fdf.c:1.90 --- php-src/ext/fdf/fdf.c:1.89 Wed Aug 3 10:07:09 2005 +++ php-src/ext/fdf/fdf.c Mon Aug 22 08:22:08 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fdf.c,v 1.89 2005/08/03 14:07:09 sniper Exp $ */ +/* $Id: fdf.c,v 1.90 2005/08/22 12:22:08 dmitry Exp $ */ /* FdfTk lib 2.0 is a Complete C/C++ FDF Toolkit available from http://beta1.adobe.com/ada/acrosdk/forms.html. */ @@ -1573,7 +1573,7 @@ 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 @@ 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; http://cvs.php.net/diff.php/php-src/ext/ldap/ldap.c?r1=1.161&r2=1.162&ty=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.161 php-src/ext/ldap/ldap.c:1.162 --- php-src/ext/ldap/ldap.c:1.161 Wed Aug 3 10:07:22 2005 +++ php-src/ext/ldap/ldap.c Mon Aug 22 08:22:08 2005 @@ -22,7 +22,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ldap.c,v 1.161 2005/08/03 14:07:22 sniper Exp $ */ +/* $Id: ldap.c,v 1.162 2005/08/22 12:22:08 dmitry Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -314,7 +314,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.161 2005/08/03 14:07:22 sniper Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.162 2005/08/22 12:22:08 dmitry Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -2199,7 +2199,7 @@ { 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 @@ /* 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) { http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.118&r2=1.119&ty=u Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.118 php-src/ext/mysqli/mysqli_api.c:1.119 --- php-src/ext/mysqli/mysqli_api.c:1.118 Wed Aug 3 10:07:30 2005 +++ php-src/ext/mysqli/mysqli_api.c Mon Aug 22 08:22:09 2005 @@ -15,7 +15,7 @@ | Author: Georg Richter <georg@php.net> | +----------------------------------------------------------------------+ - $Id: mysqli_api.c,v 1.118 2005/08/03 14:07:30 sniper Exp $ + $Id: mysqli_api.c,v 1.119 2005/08/22 12:22:09 dmitry Exp $ */ #ifdef HAVE_CONFIG_H @@ -1105,7 +1105,7 @@ { 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 @@ /* 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); http://cvs.php.net/diff.php/php-src/ext/pcntl/pcntl.c?r1=1.48&r2=1.49&ty=u Index: php-src/ext/pcntl/pcntl.c diff -u php-src/ext/pcntl/pcntl.c:1.48 php-src/ext/pcntl/pcntl.c:1.49 --- php-src/ext/pcntl/pcntl.c:1.48 Wed Aug 3 10:07:37 2005 +++ php-src/ext/pcntl/pcntl.c Mon Aug 22 08:22:10 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pcntl.c,v 1.48 2005/08/03 14:07:37 sniper Exp $ */ +/* $Id: pcntl.c,v 1.49 2005/08/22 12:22:10 dmitry Exp $ */ #define PCNTL_DEBUG 0 @@ -521,7 +521,7 @@ 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 @@ } 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); http://cvs.php.net/diff.php/php-src/ext/pcre/php_pcre.c?r1=1.169&r2=1.170&ty=u Index: php-src/ext/pcre/php_pcre.c diff -u php-src/ext/pcre/php_pcre.c:1.169 php-src/ext/pcre/php_pcre.c:1.170 --- php-src/ext/pcre/php_pcre.c:1.169 Thu Aug 18 09:34:00 2005 +++ php-src/ext/pcre/php_pcre.c Mon Aug 22 08:22:10 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pcre.c,v 1.169 2005/08/18 13:34:00 sniper Exp $ */ +/* $Id: php_pcre.c,v 1.170 2005/08/22 12:22:10 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1128,7 +1128,7 @@ 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 @@ 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); http://cvs.php.net/diff.php/php-src/ext/pdo/pdo_stmt.c?r1=1.122&r2=1.123&ty=u Index: php-src/ext/pdo/pdo_stmt.c diff -u php-src/ext/pdo/pdo_stmt.c:1.122 php-src/ext/pdo/pdo_stmt.c:1.123 --- php-src/ext/pdo/pdo_stmt.c:1.122 Tue Aug 16 15:43:23 2005 +++ php-src/ext/pdo/pdo_stmt.c Mon Aug 22 08:22:11 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdo_stmt.c,v 1.122 2005/08/16 19:43:23 andrei Exp $ */ +/* $Id: pdo_stmt.c,v 1.123 2005/08/22 12:22:11 dmitry Exp $ */ /* The PDO Statement Handle Class */ @@ -632,7 +632,6 @@ 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 @@ 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 @@ 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; http://cvs.php.net/diff.php/php-src/ext/pdo_sqlite/sqlite_driver.c?r1=1.21&r2=1.22&ty=u Index: php-src/ext/pdo_sqlite/sqlite_driver.c diff -u php-src/ext/pdo_sqlite/sqlite_driver.c:1.21 php-src/ext/pdo_sqlite/sqlite_driver.c:1.22 --- php-src/ext/pdo_sqlite/sqlite_driver.c:1.21 Fri Aug 12 19:32:31 2005 +++ php-src/ext/pdo_sqlite/sqlite_driver.c Mon Aug 22 08:22:11 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sqlite_driver.c,v 1.21 2005/08/12 23:32:31 wez Exp $ */ +/* $Id: sqlite_driver.c,v 1.22 2005/08/22 12:22:11 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -457,7 +457,7 @@ 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 @@ 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 @@ 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 @@ 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; http://cvs.php.net/diff.php/php-src/ext/readline/readline.c?r1=1.42&r2=1.43&ty=u Index: php-src/ext/readline/readline.c diff -u php-src/ext/readline/readline.c:1.42 php-src/ext/readline/readline.c:1.43 --- php-src/ext/readline/readline.c:1.42 Wed Aug 3 10:07:42 2005 +++ php-src/ext/readline/readline.c Mon Aug 22 08:22:11 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: readline.c,v 1.42 2005/08/03 14:07:42 sniper Exp $ */ +/* $Id: readline.c,v 1.43 2005/08/22 12:22:11 dmitry Exp $ */ /* {{{ includes & prototypes */ @@ -441,16 +441,18 @@ 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 @@ PHP_FUNCTION(readline_callback_handler_install) { zval *callback; - char *name = NULL; + zval name; char *prompt; int prompt_len; @@ -498,9 +500,11 @@ } 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(); http://cvs.php.net/diff.php/php-src/ext/session/session.c?r1=1.417&r2=1.418&ty=u Index: php-src/ext/session/session.c diff -u php-src/ext/session/session.c:1.417 php-src/ext/session/session.c:1.418 --- php-src/ext/session/session.c:1.417 Wed Aug 3 10:07:44 2005 +++ php-src/ext/session/session.c Mon Aug 22 08:22:12 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: session.c,v 1.417 2005/08/03 14:07:44 sniper Exp $ */ +/* $Id: session.c,v 1.418 2005/08/22 12:22:12 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1377,7 +1377,7 @@ 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 @@ 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); http://cvs.php.net/diff.php/php-src/ext/spl/php_spl.c?r1=1.58&r2=1.59&ty=u Index: php-src/ext/spl/php_spl.c diff -u php-src/ext/spl/php_spl.c:1.58 php-src/ext/spl/php_spl.c:1.59 --- php-src/ext/spl/php_spl.c:1.58 Mon Aug 15 13:29:04 2005 +++ php-src/ext/spl/php_spl.c Mon Aug 22 08:22:12 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_spl.c,v 1.58 2005/08/15 17:29:04 dmitry Exp $ */ +/* $Id: php_spl.c,v 1.59 2005/08/22 12:22:12 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -371,40 +371,39 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ } } - free_alloca(lc_name); + efree(lc_name); RETURN_BOOL(success == SUCCESS); } /* }}} */ http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.c?r1=1.81&r2=1.82&ty=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.81 php-src/ext/spl/spl_iterators.c:1.82 --- php-src/ext/spl/spl_iterators.c:1.81 Mon Aug 15 15:16:30 2005 +++ php-src/ext/spl/spl_iterators.c Mon Aug 22 08:22:12 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_iterators.c,v 1.81 2005/08/15 19:16:30 helly Exp $ */ +/* $Id: spl_iterators.c,v 1.82 2005/08/22 12:22:12 dmitry Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -672,9 +672,9 @@ 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; } http://cvs.php.net/diff.php/php-src/ext/sqlite/sqlite.c?r1=1.169&r2=1.170&ty=u Index: php-src/ext/sqlite/sqlite.c diff -u php-src/ext/sqlite/sqlite.c:1.169 php-src/ext/sqlite/sqlite.c:1.170 --- php-src/ext/sqlite/sqlite.c:1.169 Tue Aug 16 11:09:47 2005 +++ php-src/ext/sqlite/sqlite.c Mon Aug 22 08:22:13 2005 @@ -17,7 +17,7 @@ | Marcus Boerger <helly@php.net> | +----------------------------------------------------------------------+ - $Id: sqlite.c,v 1.169 2005/08/16 15:09:47 dmitry Exp $ + $Id: sqlite.c,v 1.170 2005/08/22 12:22:13 dmitry Exp $ */ #ifdef HAVE_CONFIG_H @@ -430,7 +430,8 @@ 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 @@ 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 @@ } } 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); @@ -1125,7 +1126,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, "SQLite support", "enabled"); - php_info_print_table_row(2, "PECL Module version", PHP_SQLITE_MODULE_VERSION " $Id: sqlite.c,v 1.169 2005/08/16 15:09:47 dmitry Exp $"); + php_info_print_table_row(2, "PECL Module version", PHP_SQLITE_MODULE_VERSION " $Id: sqlite.c,v 1.170 2005/08/22 12:22:13 dmitry Exp $"); php_info_print_table_row(2, "SQLite Library", sqlite_libversion()); php_info_print_table_row(2, "SQLite Encoding", sqlite_libencoding()); php_info_print_table_end(); @@ -3000,7 +3001,7 @@ 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 @@ } 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 @@ 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 @@ } 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); http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.320&r2=1.321&ty=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.320 php-src/ext/standard/array.c:1.321 --- php-src/ext/standard/array.c:1.320 Fri Aug 19 03:49:41 2005 +++ php-src/ext/standard/array.c Mon Aug 22 08:22:13 2005 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.320 2005/08/19 07:49:41 dmitry Exp $ */ +/* $Id: array.c,v 1.321 2005/08/22 12:22:13 dmitry Exp $ */ #include "php.h" #include "php_ini.h" @@ -1139,18 +1139,18 @@ 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 @@ 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 @@ 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 @@ } 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 @@ } 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 @@ } 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 @@ 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 @@ 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 @@ } 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 @@ } 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 @@ } 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 @@ 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 @@ } 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 @@ 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 @@ 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 @@ 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 @@ 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); http://cvs.php.net/diff.php/php-src/ext/standard/basic_functions.c?r1=1.729&r2=1.730&ty=u Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.729 php-src/ext/standard/basic_functions.c:1.730 --- php-src/ext/standard/basic_functions.c:1.729 Sat Aug 13 06:16:04 2005 +++ php-src/ext/standard/basic_functions.c Mon Aug 22 08:22:14 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.729 2005/08/13 10:16:04 helly Exp $ */ +/* $Id: basic_functions.c,v 1.730 2005/08/22 12:22:14 dmitry Exp $ */ #include "php.h" #include "php_streams.h" @@ -2029,7 +2029,7 @@ { zval ***params; zval *retval_ptr; - char *name; + zval name; int argc = ZEND_NUM_ARGS(); if (argc < 1) { @@ -2051,8 +2051,9 @@ } 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 @@ 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 @@ 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 @@ } 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 @@ 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 @@ 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 @@ { zval_dtor(&retval); } - if (function_name) { - efree(function_name); - } + zval_dtor(&function_name); return 0; } @@ -2363,7 +2363,7 @@ 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 @@ /* 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 @@ } 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); } /* }}} */ http://cvs.php.net/diff.php/php-src/ext/standard/type.c?r1=1.34&r2=1.35&ty=u Index: php-src/ext/standard/type.c diff -u php-src/ext/standard/type.c:1.34 php-src/ext/standard/type.c:1.35 --- php-src/ext/standard/type.c:1.34 Sat Aug 13 17:18:47 2005 +++ php-src/ext/standard/type.c Mon Aug 22 08:22:15 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: type.c,v 1.34 2005/08/13 21:18:47 helly Exp $ */ +/* $Id: type.c,v 1.35 2005/08/22 12:22:15 dmitry Exp $ */ #include "php.h" #include "php_incomplete_class.h" @@ -407,7 +407,7 @@ 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 @@ 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); } http://cvs.php.net/diff.php/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.104&r2=1.105&ty=u Index: php-src/ext/sybase_ct/php_sybase_ct.c diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.104 php-src/ext/sybase_ct/php_sybase_ct.c:1.105 --- php-src/ext/sybase_ct/php_sybase_ct.c:1.104 Thu Aug 18 09:34:04 2005 +++ php-src/ext/sybase_ct/php_sybase_ct.c Mon Aug 22 08:22:15 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_sybase_ct.c,v 1.104 2005/08/18 13:34:04 sniper Exp $ */ +/* $Id: php_sybase_ct.c,v 1.105 2005/08/22 12:22:15 dmitry Exp $ */ #ifdef HAVE_CONFIG_H @@ -2182,7 +2182,7 @@ 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 @@ 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: http://cvs.php.net/diff.php/php-src/ext/xsl/xsltprocessor.c?r1=1.39&r2=1.40&ty=u Index: php-src/ext/xsl/xsltprocessor.c diff -u php-src/ext/xsl/xsltprocessor.c:1.39 php-src/ext/xsl/xsltprocessor.c:1.40 --- php-src/ext/xsl/xsltprocessor.c:1.39 Wed Aug 3 10:08:23 2005 +++ php-src/ext/xsl/xsltprocessor.c Mon Aug 22 08:22:16 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xsltprocessor.c,v 1.39 2005/08/03 14:08:23 sniper Exp $ */ +/* $Id: xsltprocessor.c,v 1.40 2005/08/22 12:22:16 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -134,7 +134,7 @@ zval handler; xmlXPathObjectPtr obj; char *str; - char *callable = NULL; + zval callable; xsl_object *intern; TSRMLS_FETCH(); @@ -265,10 +265,10 @@ 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 @@ zval_ptr_dtor(&retval); } } - efree(callable); + zval_dtor(&callable); zval_dtor(&handler); if (fci.param_count > 0) { for (i = 0; i < nargs - 1; i++) { http://cvs.php.net/diff.php/php-src/main/output.c?r1=1.169&r2=1.170&ty=u Index: php-src/main/output.c diff -u php-src/main/output.c:1.169 php-src/main/output.c:1.170 --- php-src/main/output.c:1.169 Thu Aug 18 06:18:40 2005 +++ php-src/main/output.c Mon Aug 22 08:22:16 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: output.c,v 1.169 2005/08/18 10:18:40 dmitry Exp $ */ +/* $Id: output.c,v 1.170 2005/08/22 12:22:16 dmitry Exp $ */ #include "php.h" #include "ext/standard/head.h" @@ -554,16 +554,16 @@ } } } 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) {