Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_exceptions.c
| From: | Marcus Boerger | Date: | Thu, 18 Aug 2005 18:34:54 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_exceptions.c | ||
| References: | 1 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-4046@lists.php.net to get a copy of this message | ||
Hello Dmitry,
seeing all this and remembering the list of printf usages in the engine,
shouldn't we have a zend_uspprintf pointer and vuspprintf in the engine as
well be able to easily generate unicode strings where appropriate or even
required instead of generating native strings and converting them later
always like we do atm?
regards
marcus
Thursday, August 18, 2005, 12:18:12 PM, you wrote:
> dmitry Thu Aug 18 06:18:12 2005 EDT
> Modified files:
> /ZendEngine2 zend_exceptions.c
> Log:
> Unicode support
>
> http://cvs.php.net/diff.php/ZendEngine2/zend_exceptions.c?r1=1.84&r2=1.85&ty=u
> Index: ZendEngine2/zend_exceptions.c
> diff -u ZendEngine2/zend_exceptions.c:1.84 ZendEngine2/zend_exceptions.c:1.85
> --- ZendEngine2/zend_exceptions.c:1.84 Tue Aug 16 06:49:38 2005
> +++ ZendEngine2/zend_exceptions.c Thu Aug 18 06:18:12 2005
> @@ -19,7 +19,7 @@
>
> +----------------------------------------------------------------------+
> */
> -/* $Id: zend_exceptions.c,v 1.84 2005/08/16 10:49:38 dmitry Exp $ */
> +/* $Id: zend_exceptions.c,v 1.85 2005/08/18 10:18:12 dmitry Exp $ */
> #include "zend.h"
> #include "zend_API.h"
> @@ -283,7 +283,15 @@
> #define TRACE_APPEND_KEY(key)
> if (zend_hash_find(ht, key, sizeof(key), (void**)&tmp) == SUCCESS) { \
> + if (Z_TYPE_PP(tmp) == IS_UNICODE) { \
> + zval copy; \
> + int use_copy; \
> + zend_make_printable_zval(*tmp, ©, &use_copy); \
> + TRACE_APPEND_STRL(Z_STRVAL(copy), Z_STRLEN(copy)); \
> + zval_dtor(©); \
> + } else { \
> TRACE_APPEND_STRL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
> + } \
> }
> static int _build_trace_args(zval **arg, int num_args, va_list args, zend_hash_key *hash_key)
> @@ -475,8 +483,6 @@
> _default_exception_get_entry(getThis(), "file", sizeof("file")-1,
> &file TSRMLS_CC);
> _default_exception_get_entry(getThis(), "line", sizeof("line")-1,
> &line TSRMLS_CC);
> - convert_to_text(&message);
> - convert_to_text(&file);
> convert_to_long(&line);
> ZVAL_STRINGL(&fname, "gettraceasstring",
> sizeof("gettraceasstring")-1, 0);
> @@ -498,12 +504,12 @@
> }
> if (Z_UNILEN(message) > 0) {
> - len = zend_spprintf(&str, 0, "exception '%v' with
> message '%R' in %s:%ld\nStack trace:\n%s",
> -
> Z_OBJCE_P(getThis())->name, Z_TYPE(message), Z_UNIVAL(message),
> Z_STRVAL(file), Z_LVAL(line),
> + len = zend_spprintf(&str, 0, "exception '%v' with
> message '%R' in %R:%ld\nStack trace:\n%s",
> +
> Z_OBJCE_P(getThis())->name, Z_TYPE(message), Z_UNIVAL(message),
> Z_TYPE(file), Z_UNIVAL(file), Z_LVAL(line),
> (trace &&
> Z_STRLEN_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n");
> } else {
> - len = zend_spprintf(&str, 0, "exception '%v' in
> %s:%ld\nStack trace:\n%s",
> -
> Z_OBJCE_P(getThis())->name, Z_STRVAL(file), Z_LVAL(line),
> + len = zend_spprintf(&str, 0, "exception '%v' in
> %R:%ld\nStack trace:\n%s",
> +
> Z_OBJCE_P(getThis())->name, Z_TYPE(file), Z_UNIVAL(file), Z_LVAL(line),
> (trace &&
> Z_STRLEN_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n");
> }
Best regards,
Marcus