When I was going over error handling in php’s manual, someone posted an interesting comment regarding a possible conflict. Here’s the link: http://www.php.net/manual/en/errorfunc.configuration.php.
Basically, it stated that calling session_start() before error_reporting() would cause error_reporting() to behave incorrectly. Instead, the order would have to be flipped. I was curious of anyone experienced this issue before.
More importantly, though, if there is an issue, how will that affect classes? For instance, if I were to implement a class – such as user login – with it’s own specific error handling system involving error_reporting(), would there be a conflict? To be more specific, if I had a file with session_start() then I call the class like I stated above.
Thanks in advanced.
First, the two functions are obviously completely unrelated.
Second, I’ve called
error_reportingboth before and aftersession_startand never witnessed a problem. No one who uses my framework has reporting any issues either. It’s best to seterror_reportingonce near the start of the application, but sometimes I’ll set it at a deeper level when debugging a specific section of other people’s code.However, if you were to output errors (display errors on) before starting the session, you can get header warnings if you’re not output buffering.