]> granicus.if.org Git - php/commitdiff
fix #13 output buffering not working during execution
authorkrakjoe <joe.watkins@live.co.uk>
Wed, 20 Nov 2013 14:19:15 +0000 (14:19 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Wed, 20 Nov 2013 14:19:15 +0000 (14:19 +0000)
phpdbg.c
phpdbg_prompt.c
test.php

index 200c48d376addcf8f0f1673fa7fdded689340677..0caefcf60f3f8a48be4ad110c49476c6af19c89c 100644 (file)
--- 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 */
 
index 290f97bd0c406ced2c676930ba1dd9f62ae9f131..10fb60a90068166be48d4d526094add2ffe4f806 100644 (file)
@@ -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;
index 4da4e08f97e244a6d2c9be90fbae36f5bf86ea20..0b73ce9baeadf7a02531a4cd4025f6723976912d 100644 (file)
--- 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;
 ?>