Bug #65416 [Nab]: output buffering autostart setting php.ini

From: Date: Mon, 19 Aug 2013 22:19:57 +0000
Subject: Bug #65416 [Nab]: output buffering autostart setting php.ini
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-181019@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65416&edit=1

 ID:                 65416
 Updated by:         mike@php.net
 Reported by:        jwestbrook at gmail dot com
 Summary:            output buffering autostart setting php.ini
 Status:             Not a bug
 Type:               Bug
 Package:            Output Control
 Operating System:   linux 64bit AWS ami
 PHP Version:        5.4.17
 Block user comment: N
 Private report:     N

 New Comment:

Looks like when this is logged, there actually is no output buffer active, so 
ob_get_length() returns false.


Previous Comments:
------------------------------------------------------------------------
[2013-08-19 22:07:01] jwestbrook at gmail dot com

I also tried the settings of On and 1.

I also understand that #!/usr/bin/php means nothing to output buffering but is output that 
I want to capture if the php file is being run from a browser and discard.

From what I understand that is not how the output buffering works. The way I understand it 
the output buffer fills then dumps everything when it is full. In this instance before the 
output buffer fills I want to discard the first 15 characters because it will corrupt any 
binary files that the browser is trying to download.


Based on the test script attached ob_get_length() should ALWAYS return 15 characters - 
however at least 12 times a day PHP fails to start the output buffer and I get the error 
shown.

------------------------------------------------------------------------
[2013-08-18 06:52:49] yohgaki@php.net

"#!" does not have special meaning for Web server SAPI.

I think you are sending data larger than output buffer size. Then this is the 
way supposed to be.

output_buffering=On or 1 is special. It enables unlimited buffering. Anything 
other values set buffer chunk size and PHP tries to send data larger than chunk 
size.

Check your buffer size (i.e. output_buffering setting of php.ini file)
I guess you have very small output_buffering. Old output buffer increases size 
automatically, IIRC. New output buffer does not increase buffer size.

------------------------------------------------------------------------
[2013-08-07 19:47:35] jwestbrook at gmail dot com

Description:
------------
We recently upgraded from php 5.3 to php 5.4 and when the php.ini output_buffering 
setting is set to ON or anything greater than zero the output buffering does not 
always reliably start.


This is a problem for some scripts that have a shebang as the first line to make 
the script easily executable. But if you send a header or anything else after that 
first line it will fail.


based on the script attached the contents of the error log are

buffer statues : Array\n(\n)\n

Test script:
---------------
#!/usr/bin/php
<?php

$buffer_length = ob_get_length();
if($buffer_length != 15)
{
    error_log('buffer statues : '.print_r(ob_get_status(TRUE),1));
    exit;
}

//this header call will not always be successful
header("Content-type: application/pdf");

?>



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65416&edit=1


Thread (11 messages)

« previous php.bugs (#181019) next »