citpes Posted December 7, 2007 Share Posted December 7, 2007 Hey guys I'm having a problem with output buffers in php. I have been coding php for awhile, but not used them until now. The problem is that my buffers seem to be disappearing halfway through my script. I have done some debugging and it seems to happen when I reference an array key that doesn't exist. I have notices turned off in my php.ini. I'm assuming it has something to do with php trying to suppress the notice warning. I might be wrong that that is even the cause, but I cant find anything on google about buffers going awol and its my best guess so far Anyone else had this, or am I just plainly doing something wrong. Thanks in advance. PS: I didnt post code because its not a short script, I can however try to extract the relevant parts if anyone thinks it will help. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 7, 2007 Share Posted December 7, 2007 php 5.2.4 has a bug when php terminates due to a fatal runtime error that the output buffer is not flushed as part of the shut down logic. What version of php are you using? What exactly is the error message from your web server log? It would probably be a good idea to correct the logic to prevent referencing array keys that don't exist. Code should not normally triggers any notice/warning/fatal errors. Quote Link to comment Share on other sites More sharing options...
citpes Posted December 7, 2007 Author Share Posted December 7, 2007 I'm using 5.2.1. There isnt an error at all, and all the output shows on the screen in the correct order. The problem is when it gets to the point of the bad array key, it seems to flush everything and lose the current buffers (like a script termination would, but it continues to run the script). So if you look at the output, you wouldnt even know there's a problem. I only noticed because now I want to flush some output to a buffer at the top of my script, and show it later. Quote Link to comment Share on other sites More sharing options...
citpes Posted December 7, 2007 Author Share Posted December 7, 2007 I would like to state, for the record, that I'm an idiot There was a custom error handler used, that did nothing but return true (which just returns control to the default error handler. I think it did this because error handling was going to be put in). But before returning true, it looped through all open buffers and flushed them. I never even thought to look at the error handler because there was no error being thrown. Sorry for the waste of time, and thanks for taking the time to try help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.