[Solar-talk] Solar_Http_Response and check-headers-sent

Paul M Jones pmjones at ciaweb.net
Fri Jun 1 09:09:00 PDT 2007


Hey Antti:

Regarding the report at <http://solarphp.com/trac/ticket/74> --

>  I'm Using Solar_http_*Request* in console (think webservices or  
> something
>  like that) which returns a Solar_Http_Response when I do a fetch 
> (). If I
>  echo something to the screen *before* I do the fetch() (which  
> tries to
>  setHeader() for the *response* when it gets a response) I get a
>  ERR_HEADERS_SENT error. This is because S_H_Response uses  
> headers_sent()
>  internally, which should have nothing to do with my console script.
>  Obviously a check to headers_sent() is needed by Solar when sending a
>  normal response back to browser (normal use).
>
>  One solution would be to check for headers_sent() only when sending a
>  response to a browser and otherwise just always allow setHeader().  
> Maybe
>  add a Solar_Response class for Solar internal use (like  
> Solar_Request).

Let me make sure I understand:  You're working at the command line,  
and you're going to echo the Solar_Http_Response to the command line,  
so of course the headers aren't going to be part of the output  
(wouldn't make sense).

If that's correct, then it would make sense for Request and Response  
to be aware that you're at the CLI and not check headers_sent() in  
that case.

Would that help?



--

Paul M. Jones  <http://paul-m-jones.com>

Solar: Simple Object Library and Application Repository
for PHP5.  <http://solarphp.com>

Join the Solar community wiki!  <http://solarphp.org>

Savant: The simple, elegant, and powerful solution for
templates in PHP.  <http://phpsavant.com>




More information about the solar-talk mailing list