I needed to know output buffering nesting level to replace output
when there is error. This is the patch for this.
int ob_get_level(void)
Return current output buffering nesting level. It includes output
buffers set in php.ini (output_buffer, output_handler and
zlib.output_compression if set)
--
Yasuo Ohgaki
Index: output.c
===================================================================
RCS file: /repository/php4/main/output.c,v
retrieving revision 1.80
diff -u -r1.80 output.c
--- output.c 30 Nov 2001 10:48:38 -0000 1.80
+++ output.c 2 Dec 2001 22:20:58 -0000
@@ -585,6 +585,15 @@
}
/* }}} */
+/* {{{ proto integer ob_get_level(void)
+ Return the nesting level of the output buffer */
+PHP_FUNCTION(ob_get_level)
+{
+ Z_LVAL_P(return_value) = OG(ob_nesting_level);
+ Z_TYPE_P(return_value) = IS_LONG;
+}
+/* }}} */
+
/* {{{ proto void ob_implicit_flush([int flag])
Turn implicit flush on/off and is equivalent to calling flush() after every output
call */
PHP_FUNCTION(ob_implicit_flush)
Index: php_output.h
===================================================================
RCS file: /repository/php4/main/php_output.h,v
retrieving revision 1.31
diff -u -r1.31 php_output.h
--- php_output.h 30 Nov 2001 10:48:38 -0000 1.31
+++ php_output.h 2 Dec 2001 22:20:58 -0000
@@ -49,6 +49,7 @@
PHP_FUNCTION(ob_end_clean);
PHP_FUNCTION(ob_get_contents);
PHP_FUNCTION(ob_get_length);
+PHP_FUNCTION(ob_get_level);
PHP_FUNCTION(ob_implicit_flush);
typedef struct _php_ob_buffer {
Index: basic_functions.c
===================================================================
RCS file: /repository/php4/ext/standard/basic_functions.c,v
retrieving revision 1.423
diff -u -r1.423 basic_functions.c
--- basic_functions.c 30 Nov 2001 10:48:38 -0000 1.423
+++ basic_functions.c 2 Dec 2001 22:22:10 -0000
@@ -725,6 +725,7 @@
PHP_FE(ob_end_flush,
NULL)
PHP_FE(ob_end_clean,
NULL)
PHP_FE(ob_get_length,
NULL)
+ PHP_FE(ob_get_level,
+ NULL)
PHP_FE(ob_get_contents,
NULL)
PHP_FE(ob_implicit_flush,
NULL)
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]