yohgaki         Thu Oct  3 03:17:14 2002 EDT

  Modified files:              
    /php4/ext/mbstring/tests    007.inc 
    /php4/ext/standard  basic_functions.c 
    /php4/main  output.c php_output.h 
  Log:
  Added ob_flush_all() that flushes bufferred contents until it actually
  sent/printed.
  @ Added ob_flush_all() that flushes all buffers. (Yasuo)
  
  
Index: php4/ext/mbstring/tests/007.inc
diff -u php4/ext/mbstring/tests/007.inc:1.1 php4/ext/mbstring/tests/007.inc:1.2
--- php4/ext/mbstring/tests/007.inc:1.1 Sat Mar  2 05:44:57 2002
+++ php4/ext/mbstring/tests/007.inc     Thu Oct  3 03:17:12 2002
@@ -6,6 +6,8 @@
 mb_http_output('EUC-JP') or print("mb_http_output() failed\n");
 ob_start('mb_output_handler');
 echo $euc_jp;
-ob_end_flush();
+$output = ob_get_clean();
+
+var_dump( $output );
 
 ?>
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.517 
php4/ext/standard/basic_functions.c:1.518
--- php4/ext/standard/basic_functions.c:1.517   Wed Oct  2 21:36:43 2002
+++ php4/ext/standard/basic_functions.c Thu Oct  3 03:17:12 2002
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.517 2002/10/03 01:36:43 yohgaki Exp $ */
+/* $Id: basic_functions.c,v 1.518 2002/10/03 07:17:12 yohgaki Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -747,6 +747,7 @@
        /* functions from output.c */
        PHP_FE(ob_start,                                                               
                                                 NULL)
        PHP_FE(ob_flush,                                                               
                                                 NULL)
+       PHP_FE(ob_flush_all,                                                           
+                                         NULL)
        PHP_FE(ob_clean,                                                               
                                                 NULL)
        PHP_FE(ob_end_flush,                                                           
                                         NULL)
        PHP_FE(ob_end_clean,                                                           
                                         NULL)
Index: php4/main/output.c
diff -u php4/main/output.c:1.132 php4/main/output.c:1.133
--- php4/main/output.c:1.132    Thu Oct  3 00:17:41 2002
+++ php4/main/output.c  Thu Oct  3 03:17:13 2002
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: output.c,v 1.132 2002/10/03 04:17:41 yohgaki Exp $ */
+/* $Id: output.c,v 1.133 2002/10/03 07:17:13 yohgaki Exp $ */
 
 #include "php.h"
 #include "ext/standard/head.h"
@@ -739,7 +739,7 @@
 /* }}} */
 
 /* {{{ proto bool ob_flush(void)
-   Flush (send) contents of the output buffers */
+   Flush (send) contents of the output buffer. The last buffer content is sent to 
+next buffer */
 PHP_FUNCTION(ob_flush)
 {
        if (ZEND_NUM_ARGS() != 0)
@@ -749,8 +749,31 @@
                php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to 
flush buffer. No buffer to flush.");
                RETURN_FALSE;
        }
-               
+       
        php_end_ob_buffer(1, 1 TSRMLS_CC);
+       RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto bool ob_flush_all(void)
+   Flush (send) contents of output buffers. All buffered contents will be 
+written/sent */
+PHP_FUNCTION(ob_flush_all)
+{
+       int orig;
+       
+       if (ZEND_NUM_ARGS() != 0)
+                       WRONG_PARAM_COUNT;
+
+       if (!OG(ob_nesting_level)) {
+               php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to 
+flush buffer. No buffer to flush.");
+               RETURN_FALSE;
+       }
+
+       orig = OG(implicit_flush); /* save current implicit flush state */
+       php_start_implicit_flush(TSRMLS_C);
+       php_end_ob_buffer(1, 1 TSRMLS_CC);
+       OG(implicit_flush) = orig;
+       
        RETURN_TRUE;
 }
 /* }}} */
Index: php4/main/php_output.h
diff -u php4/main/php_output.h:1.45 php4/main/php_output.h:1.46
--- php4/main/php_output.h:1.45 Wed Oct  2 23:58:12 2002
+++ php4/main/php_output.h      Thu Oct  3 03:17:14 2002
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_output.h,v 1.45 2002/10/03 03:58:12 yohgaki Exp $ */
+/* $Id: php_output.h,v 1.46 2002/10/03 07:17:14 yohgaki Exp $ */
 
 #ifndef PHP_OUTPUT_H
 #define PHP_OUTPUT_H
@@ -47,6 +47,7 @@
 
 PHP_FUNCTION(ob_start);
 PHP_FUNCTION(ob_flush);
+PHP_FUNCTION(ob_flush_all);
 PHP_FUNCTION(ob_clean);
 PHP_FUNCTION(ob_end_flush);
 PHP_FUNCTION(ob_end_clean);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to