PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have some scripts that generate errors, but redirect (ie the scripts don't generate the dreaded headers already sent). It seems to only happen with NOTICE level errors. So I guess that PHP is output buffering the errors in some manner, is there anyway to stop this behavoir? (Short of my adding die() before the redirects for debugging use)
I try to. But when I fail I like to know that I failed and be able to fix it. That's why I develop with E_ALL and error_reporting on. And its why it annoys me if PHP decides to hide the errors from me....
I've ran into a few instances where I could echo just barely before I used a header() and it'd go through.. so there's definitely some buffering going on at times.
If you want to be certain there is no buffering switch off output buffering in php.ini. Also switch on implicit_flush. You could put all this in an included function with error reporting so you don't need to alter php.ini just include the function at the start of the script. Then after every echo add flush(). This way you can be certain there is no buffering by php.
I've tried with implict flush on (and off). No change. There are no echo's to flush only the error's generated by PHP. I've tried adding a call to flush() before the header(), no change.
I've found that the output buffering of the server can do this too, unfortunately, most of us don't have control enough to turn off that "feature" in servers.. so at times, it's entirely unavoidable.