From: Michael Wallner Date: Tue, 3 Oct 2006 22:20:28 +0000 (+0000) Subject: - fix failure with tests/lang/bug23489.phpt X-Git-Tag: RELEASE_1_0_0RC1~1441 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=32186c45fb866ca2ede1ddb7c5fd60736b9cdec3;p=php - fix failure with tests/lang/bug23489.phpt - allocate fci param space at once with php_output_handler_user_func_t --- diff --git a/main/output.c b/main/output.c index b1e909cf48..e72a94b5bb 100644 --- a/main/output.c +++ b/main/output.c @@ -509,8 +509,13 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, MAKE_STD_ZVAL(handler_name); zend_make_callable(output_handler, handler_name TSRMLS_CC); handler = php_output_handler_init(handler_name, chunk_size, (flags & ~0xf) | PHP_OUTPUT_HANDLER_USER); - handler->func.user = user; zval_ptr_dtor(&handler_name); + + ZVAL_ADDREF(output_handler); + user->zoh = output_handler; + user->fci.param_count = 2; + user->fci.params = (zval ***) &user->fcp; + handler->func.user = user; } else { efree(user); } @@ -710,6 +715,7 @@ PHPAPI void php_output_handler_dtor(php_output_handler *handler TSRMLS_DC) zval_ptr_dtor(&handler->name); STR_FREE(handler->buffer.data); if (handler->flags & PHP_OUTPUT_HANDLER_USER) { + zval_ptr_dtor(&handler->func.user->zoh); efree(handler->func.user); } if (handler->dtor && handler->opaq) { @@ -944,8 +950,6 @@ static inline int php_output_handler_op(php_output_handler *handler, php_output_ ZVAL_STRINGL(params[0], handler->buffer.data, handler->buffer.used, 1); MAKE_STD_ZVAL(params[1]); ZVAL_LONG(params[1], (long) context->op); - handler->func.user->fci.param_count = 2; - handler->func.user->fci.params = (zval***) safe_emalloc(handler->func.user->fci.param_count, sizeof(zval**), 0); handler->func.user->fci.params[0] = ¶ms[0]; handler->func.user->fci.params[1] = ¶ms[1]; @@ -966,7 +970,8 @@ static inline int php_output_handler_op(php_output_handler *handler, php_output_ /* call failed, pass internal buffer along */ status = PHP_OUTPUT_HANDLER_FAILURE; } - zend_fcall_info_args(&handler->func.user->fci, NULL TSRMLS_CC); + zval_ptr_dtor(¶ms[0]); + zval_ptr_dtor(¶ms[1]); if (retval) { zval_ptr_dtor(&retval); } diff --git a/main/php_output.h b/main/php_output.h index 355b750bb0..25130942d7 100644 --- a/main/php_output.h +++ b/main/php_output.h @@ -114,6 +114,8 @@ typedef struct _php_output_handler *(*php_output_handler_alias_ctor_t)(zval *han typedef struct _php_output_handler_user_func_t { zend_fcall_info fci; zend_fcall_info_cache fcc; + zval **fcp[2]; + zval *zoh; } php_output_handler_user_func_t; typedef struct _php_output_handler {