[PHP] Output Buffering and zlib Compression Issue

2007-08-03 Thread Chris
When I run the following code (PHP 5.2.2, 5.2.3) via Apache (with an  
htaccess file), I get this error:


Notice: ob_end_clean() [ref.outcontrol]: failed to delete buffer zlib  
output compression. in ...


Can anyone explain what's going on?

I'm assuming it isn't a bug and I've read the documentation. Did I  
miss something?



htaccess file code:

php_flag output_buffering Off
php_flag zlib.output_compression On
php_value zlib.output_compression_level -1


PHP Code:

?php

error_reporting(E_ALL | E_NOTICE);
ini_set('display_errors', '1');

ob_start();

echo You shouldn't see this.;

while (ob_get_level()  0) {
ob_end_clean();
}

ob_start();

echo You SHOULD see this.;

ob_end_flush();

?

Chris




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



RE: [PHP] Output Buffering and zlib Compression Issue

2007-08-03 Thread Jan Reiter
Hi! 

I'm not quite sure what you are trying to do ... 
Why do you use output buffering in your code, when you turn it off in the
htaccess directive??
php_flag output_buffering Off

The code worked for me. But I tested it without your htaccess settings ... 

Jan

-Ursprüngliche Nachricht-
Von: Chris [mailto:[EMAIL PROTECTED] 
Gesendet: Samstag, 4. August 2007 01:18
An: php-general@lists.php.net
Betreff: [PHP] Output Buffering and zlib Compression Issue

When I run the following code (PHP 5.2.2, 5.2.3) via Apache (with an  
htaccess file), I get this error:

Notice: ob_end_clean() [ref.outcontrol]: failed to delete buffer zlib  
output compression. in ...

Can anyone explain what's going on?

I'm assuming it isn't a bug and I've read the documentation. Did I  
miss something?


htaccess file code:

php_flag output_buffering Off
php_flag zlib.output_compression On
php_value zlib.output_compression_level -1


PHP Code:

?php

error_reporting(E_ALL | E_NOTICE);
ini_set('display_errors', '1');

ob_start();

echo You shouldn't see this.;

while (ob_get_level()  0) {
 ob_end_clean();
}

ob_start();

echo You SHOULD see this.;

ob_end_flush();

?

Chris




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


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



RE: [PHP] Output Buffering and zlib Compression Issue

2007-08-03 Thread Jan Reiter
Right! 

With zlib compression ob_start() or similar seems to get called before the
user 
script execution. I'm not quite sure why. Anyhow ob_get_level() returns 2
after 
the ob_start() is called for the first time in the script. You can avoid the
error 
with

while (ob_get_level()  1) {
ob_end_clean();
}

but it won't kill the buffer containing output before ob_start() is called. 

ob_end_clean();
ob_end_clean();

will reproduce your error, too. This leads to the assumption, that it is an
issue
of advancing the functions internal process pointer.

Same reason why 

$data1 = mysql_fetch_assoc($resultid);
$data2 = mysql_fetch_assoc($resultid);

won't lead to the desired effect either, but 

While($data = mysql_fetch_assoc($resultid)){...}

does, as does

while (@ob_end_clean());

It seems only this way of accessing the buffers allows deleting the
lowermost buffer created before
Script execution.

Jan


-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Saturday, August 04, 2007 3:25 AM
To: php-general@lists.php.net
Subject: [PHP] Re: Output Buffering and zlib Compression Issue

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