ID: 32424 Updated by: [EMAIL PROTECTED] Reported By: tommythekid at mac dot com -Status: Analyzed +Status: Feedback Bug Type: iPlanet related Operating System: Solaris 9 SPARC PHP Version: 5.*, 4.* Assigned To: thetaphi New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5.1-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.1-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2005-06-24 13:25:41] [EMAIL PROTECTED] I analyzed this bug and found out what the problem is: In a normal response stage the following functions of the SAPI module are called: * n times header_handler() * one time send_headers() before the first call of ub_write() In the case of this bug the following happens: if you do not have any output before ob_flush() (no echo etc.) the send_headers() SAPI function is never called. In NSAPI this leads to the fact that an webserver function to start the response is never called. Further writes to ub_write will then result in loss of data. I think somewhere in SAPI.c the call to send_headers() is missing before ob_flush() when nothing was send before. A fix only for NSAPI would be to trigger the calls and before write anything with ub_write a check is done and the start_response is added. But this is not the right solution. ------------------------------------------------------------------------ [2005-03-25 16:59:25] [EMAIL PROTECTED] Hallo Jani, I experienced that problem also in my servers in the past (in some other use-case: using of the nsapi_virtual() function which does implicitly a flush of the headers and buffers in the nsapi C code) but I do not know exactly if it is a nsapi problem or some general sapi/buffers problem. What did you change? If it has something to do with NSAPI code please send me a private email with your changes, because I am not familar with the buffering code. The interesting thing is: This bug only happens when the flush/ob_flush is done before any output to the client is done (the buffer is empty). In my case: nsapi_virtual() is the first instruction in the php code. Happens also in PHP 4.3. If I should look after this bug after easter assign me to this bug. ------------------------------------------------------------------------ [2005-03-23 10:34:53] tommythekid at mac dot com Description: ------------ no output is sent after calling ob_flush() after sending headers. This problem appears to be NSAPI related. Removing the first ob_flush() from the code produces the expected results. Reproduce code: --------------- while (ob_end_clean()); ob_start(); header("X-Foo: BAR"); ob_flush(); flush(); echo "PRE\n\n"; ob_flush(); flush(); echo "POST\n\n"; ob_flush(); flush(); Expected result: ---------------- HTTP/1.1 200 OK Server: Sun-ONE-Web-Server/6.1 Date: Wed, 23 Mar 2005 09:31:45 GMT Content-type: text/html X-powered-by: PHP/5.0.3 X-foo: BAR Connection: close PRE POST Actual result: -------------- HTTP/1.1 200 OK Server: Sun-ONE-Web-Server/6.1 Date: Wed, 23 Mar 2005 09:24:38 GMT Content-type: text/html X-powered-by: PHP/5.0.3 X-foo: BAR Connection: close ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32424&edit=1
