# Bug #32424

- Thread: https://externals.io/message/15749
- Original archive: https://news-web.php.net/php.internals/15749
- Started by Uwe Schindler on 2005-04-03T12:41:30+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #15749 — Uwe Schindler — 2005-04-03T12:41:30+00:00

URL: https://externals.io/message/15749#15749

Jani assigned bug 32424 to me: http://bugs.php.net/bug.php?id=32424&edit=1

I think I have the solution for that problem, but I do not know how to fix 
it because it is not NSAPI specific and I do not know exactly whats going 
on in output.c.

The problem:

In a normal PHP request with headers to the user it works in that way (sapi 
functions called):
* sapi_nsapi_header_handler() is called for each header
* sapi_nsapi_send_headers() is called when output to client begins and 
headers should be sent (NSAPI does nothing with headers here because the 
webserver itsself send the header set before - but NSAPI calls the function 
in webserver api to start output to client and sets the status code)
* sapi_nsapi_ub_write() is called to write output

When output buffers are used and no output is sent to browser so far - 
calling ob_flush flushes its internal buffers. But in all SAPI code this 
flush function is always called *before* php_header() (in my nsapi_virtual 
code, too) what calls sapi_nsapi_send_headers() - so the webserver api to 
start the output is not called - iPlanet sends nothing to the client.

The problem with nsapi is the call to the webserver api to start output, 
other servers like apache do not have such problems because they do not 
start output explicitely:
There are two solutions:
a) Check in sapi_nsapi_ub_write() if output was initialized before (could 
be done by me - but its only bad hack)
b) Fix the SAPI to correctly keep the order of SAPI calls when flushing 
buffers etc.

What do you mean?

-----
Uwe Schindler
thetaphi@php.net - http://www.php.net
NSAPI SAPI developer
Erlangen, Germany
