From: Michael Wallner Date: Wed, 16 Feb 2005 20:08:15 +0000 (+0000) Subject: * sanitize ob_httpetaghandler X-Git-Tag: RELEASE_0_5_0~13 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=0f9c41f499873dbd4ab88469d838922554a49a99 * sanitize ob_httpetaghandler --- diff --git a/http.c b/http.c index 608586c..452ec8f 100644 --- a/http.c +++ b/http.c @@ -465,7 +465,9 @@ PHP_FUNCTION(http_cache_etag) /* {{{ proto string ob_httpetaghandler(string data, int mode) * - * For use with ob_start(). Note that this has to be started as first output buffer. + * For use with ob_start(). + * Note that this has to be started as first output buffer. + * WARNING: Don't use with http_send_*(). */ PHP_FUNCTION(ob_httpetaghandler) { @@ -479,17 +481,18 @@ PHP_FUNCTION(ob_httpetaghandler) if (mode & PHP_OUTPUT_HANDLER_START) { if (HTTP_G(etag_started)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "ob_etaghandler can only be used once"); - RETURN_FALSE; - } - if (OG(ob_nesting_level)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "must be started prior to other output buffers"); - RETURN_FALSE; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "ob_httpetaghandler can only be used once"); + RETURN_STRINGL(data, data_len, 1); } http_send_header("Cache-Control: private, must-revalidate, max-age=0"); HTTP_G(etag_started) = 1; } + if (OG(ob_nesting_level) > 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "ob_httpetaghandler must be started prior to other output buffers"); + RETURN_STRINGL(data, data_len, 1); + } + Z_TYPE_P(return_value) = IS_STRING; http_ob_etaghandler(data, data_len, &Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value), mode); }