com php-src: fix #13 output buffering not working during execution: phpdbg.c phpdbg_prompt.c test.php
| From: | Bob Weinand | Date: | Wed, 20 Nov 2013 14:19:15 +0000 |
| Subject: | com php-src: fix #13 output buffering not working during execution: phpdbg.c phpdbg_prompt.c test.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74767@lists.php.net to get a copy of this message | ||
Commit: 7a81ed4b7432d3b607a28b8ca8b210a561572222
Author: krakjoe <joe.watkins@live.co.uk> Wed, 20 Nov 2013 14:19:15 +0000
Parents: f92de15a1cacaf15e461978a8ed143d5d9e86e23
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7a81ed4b7432d3b607a28b8ca8b210a561572222
Log:
fix #13 output buffering not working during execution
Bugs:
https://bugs.php.net/13
Changed paths:
M phpdbg.c
M phpdbg_prompt.c
M test.php
Diff:
diff --git a/phpdbg.c b/phpdbg.c
index 200c48d..0caefcf 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 290f97b..10fb60a 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 4da4e08..0b73ce9 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;
?>