summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYasuo Ohgaki <yohgaki@php.net>2002-10-03 07:17:14 +0000
committerYasuo Ohgaki <yohgaki@php.net>2002-10-03 07:17:14 +0000
commit66a50c5373e8d0d7bd1fcf8accb0ac179a0122b3 (patch)
tree769abe9a509ee21901c0b3e60133d9d6887b59f9
parent4fbf3f77c083f4734d1f9a594c65974cb2ed12b0 (diff)
downloadphp-git-66a50c5373e8d0d7bd1fcf8accb0ac179a0122b3.tar.gz
Added ob_flush_all() that flushes bufferred contents until it actually
sent/printed. @ Added ob_flush_all() that flushes all buffers. (Yasuo)
-rw-r--r--ext/mbstring/tests/007.inc4
-rw-r--r--ext/standard/basic_functions.c1
-rw-r--r--main/output.c27
-rw-r--r--main/php_output.h1
4 files changed, 30 insertions, 3 deletions
diff --git a/ext/mbstring/tests/007.inc b/ext/mbstring/tests/007.inc
index 87e46da920..5436bae09f 100644
--- a/ext/mbstring/tests/007.inc
+++ b/ext/mbstring/tests/007.inc
@@ -6,6 +6,8 @@ $euc_jp = "テスト用日本語文字列。このモジュールはPHPにマルチバイト関数を提供しま
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 );
?>
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 28b7203200..ed9019b1e0 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -747,6 +747,7 @@ function_entry basic_functions[] = {
/* 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)
diff --git a/main/output.c b/main/output.c
index 88fed70fab..d266a9624a 100644
--- a/main/output.c
+++ b/main/output.c
@@ -739,7 +739,7 @@ PHP_FUNCTION(ob_start)
/* }}} */
/* {{{ 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_FUNCTION(ob_flush)
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;
}
/* }}} */
diff --git a/main/php_output.h b/main/php_output.h
index 67d16a1741..4d0f7f0697 100644
--- a/main/php_output.h
+++ b/main/php_output.h
@@ -47,6 +47,7 @@ PHPAPI int php_ob_get_length(zval *p TSRMLS_DC);
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);