ZEND_API void (*zend_unblock_interruptions)(void);
ZEND_API void (*zend_ticks_function)(int ticks);
ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
+int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
void (*zend_on_timeout)(int seconds TSRMLS_DC);
zend_get_configuration_directive_p = utility_functions->get_configuration_directive;
zend_ticks_function = utility_functions->ticks_function;
zend_on_timeout = utility_functions->on_timeout;
+ zend_vspprintf = utility_functions->vspprintf_function;
zend_compile_file = compile_file;
zend_execute = execute;
void (*ticks_function)(int ticks);
void (*on_timeout)(int seconds TSRMLS_DC);
int (*stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
+ int (*vspprintf_function)(char **pbuf, size_t max_len, const char *format, va_list ap);
} zend_utility_functions;
extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
extern void (*zend_on_timeout)(int seconds TSRMLS_DC);
extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
+extern int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
ZEND_API void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
len = va_arg(args, int*);
num = va_arg(args, int*);
- s_tmp = emalloc(Z_STRLEN_PP(file) + MAX_LENGTH_OF_LONG + 2 + 1);
+ s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 1 + 1);
sprintf(s_tmp, "#%d ", (*num)++);
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
efree(s_tmp);
{
zval *ex;
va_list arg;
-
-#ifdef _GNU_SOURCE
char *message;
+
va_start(arg, format);
- vasprintf(message, format, arg);
- va_end(arg);
-#else
- char message[1024];
- va_start(arg, format);
- vsnprintf(message, sizeof(message), format, arg);
+ zend_vspprintf(&message, 0, format, arg);
va_end(arg);
-#endif
MAKE_STD_ZVAL(ex);
if (exception_ce) {
zend_update_property_long(exception_ce, ex, "code", sizeof("code")-1, code TSRMLS_CC);
}
-#ifdef _GNU_SOURCE
- free(message);
-#endif
+ efree(message);
EG(exception) = ex;
}
len = va_arg(args, int*);
num = va_arg(args, int*);
- s_tmp = emalloc(Z_STRLEN_PP(file) + MAX_LENGTH_OF_LONG + 2 + 1);
+ s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 1 + 1);
sprintf(s_tmp, "#%d ", (*num)++);
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
efree(s_tmp);
{
zval *ex;
va_list arg;
-
-#ifdef _GNU_SOURCE
char *message;
+
va_start(arg, format);
- vasprintf(message, format, arg);
- va_end(arg);
-#else
- char message[1024];
- va_start(arg, format);
- vsnprintf(message, sizeof(message), format, arg);
+ zend_vspprintf(&message, 0, format, arg);
va_end(arg);
-#endif
MAKE_STD_ZVAL(ex);
if (exception_ce) {
zend_update_property_long(exception_ce, ex, "code", sizeof("code")-1, code TSRMLS_CC);
}
-#ifdef _GNU_SOURCE
- free(message);
-#endif
+ efree(message);
EG(exception) = ex;
}
zuf.ticks_function = php_run_ticks;
zuf.on_timeout = php_on_timeout;
zuf.stream_open_function = php_stream_open_for_zend;
+ zuf.vspprintf_function = vspprintf;
zend_startup(&zuf, NULL, 1);
#ifdef ZTS