Re: [PHP4BETA] virtual() and buffered output

[email protected] (Rasmus Lerdorf) Mon, 5 Jun 2000 14:20:59 -0700 (PDT)
Newsgroups php.version4
Message-ID <[email protected]>
Makes sense.  Thanks for the patch.

On Mon, 5 Jun 2000, Marc Pohl wrote:

> 
> hi,
> 
> i have a small patch against sapi/apache/php_apache.c (PHP4.0.0) to allow the usage of virtual() while in buffered-output-mode. the problem is, that the output of virtual() appears before any http-headers or regular output prior to the call of virtual(), because virtual() doesn't use the buffered-output-layer. 
> 
> the solution is to call php_end_ob_buffering(1) before virtual(). this also turns off the output-buffering for the remaining parts of the skript, but this should cause no real problems. after this we need an extra call of php_header() to ensure that the http-headers were really sent before calling run_sub_req().
> 
> this patch also closes error #2546 "virtual() causes HTTP headers problems".
> 
> regards 
> marc
> 
> 
> 
> diff -ur php-4.0.0-orig/sapi/apache/php_apache.c php-4.0.0/sapi/apache/php_apache.c
> --- php-4.0.0-orig/sapi/apache/php_apache.c	Thu May 18 17:34:40 2000
> +++ php-4.0.0/sapi/apache/php_apache.c	Mon Jun  5 08:21:30 2000
> @@ -320,6 +320,9 @@
>  		RETURN_FALSE;
>  	}
>  
> +	php_end_ob_buffering(1);
> +	php_header();
> +
>  	if (run_sub_req(rr)) {
>  		php_error(E_WARNING, "Unable to include '%s' - request execution failed", (*filename)->value.str.val);
>  		if (rr) destroy_sub_req (rr);
> 
> 
> 
>  ------------------------------------------------------------
> 
> Marc Pohl
>                                  Westdeutscher Rundfunk
> Tel.:  +49 221  220 8618         Service-Center-Infrastruktur
> FAX:   +49 221  220 3882         D-50600 Koeln
> Email: [email protected]
> 
> 
> 
>