From: krakjoe Date: Wed, 20 Nov 2013 14:19:15 +0000 (+0000) Subject: fix #13 output buffering not working during execution X-Git-Tag: php-5.6.0alpha1~110^2~178 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7a81ed4b7432d3b607a28b8ca8b210a561572222;p=php fix #13 output buffering not working during execution --- diff --git a/phpdbg.c b/phpdbg.c index 200c48d376..0caefcf60f 100644 --- a/phpdbg.c +++ b/phpdbg.c @@ -334,6 +334,16 @@ static void php_sapi_phpdbg_register_vars(zval *track_vars_array TSRMLS_DC) /* { } /* }}} */ +static inline int php_sapi_phpdbg_ub_write(const char *message, unsigned int length TSRMLS_DC) /* {{{ */ +{ + return phpdbg_write(message); +} /* }}} */ + +static inline void php_sapi_phpdbg_flush(void *context) /* {{{ */ +{ + fflush(stdout); +} /* }}} */ + /* {{{ sapi_module_struct phpdbg_sapi_module */ static sapi_module_struct phpdbg_sapi_module = { @@ -346,8 +356,8 @@ static sapi_module_struct phpdbg_sapi_module = { NULL, /* activate */ php_sapi_phpdbg_deactivate, /* deactivate */ - NULL, /* unbuffered write */ - NULL, /* flush */ + php_sapi_phpdbg_ub_write, /* unbuffered write */ + php_sapi_phpdbg_flush, /* flush */ NULL, /* get uid */ NULL, /* getenv */ diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 290f97bd0c..10fb60a900 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -477,8 +477,10 @@ static PHPDBG_COMMAND(run) /* {{{ */ &PHPDBG_G(seek)); zend_try { + php_output_activate(TSRMLS_C); zend_execute( EG(active_op_array) TSRMLS_CC); + php_output_deactivate(TSRMLS_C); } zend_catch { EG(active_op_array) = orig_op_array; EG(opline_ptr) = orig_opline; diff --git a/test.php b/test.php index 4da4e08f97..0b73ce9bae 100644 --- a/test.php +++ b/test.php @@ -38,4 +38,11 @@ echo "it works!\n"; if (isset($dump)) var_dump($_SERVER); + +echo 'Start'; +ob_start(); +echo 'Hello'; +$b = ob_get_clean(); +echo 'End'; +echo $b; ?>