PHP's session_start() conflicting with error_reporting()?

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.

Answers


First, the two functions are obviously completely unrelated.

Second, I've called error_reporting both before and after session_start and never witnessed a problem. No one who uses my framework has reporting any issues either. It's best to set error_reporting once 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.


Need Your Help

How to merge the latest revision from another branch without merging the branches completely?

version-control merge mercurial branch tortoisehg

I'm using a mercurial GUI TortoiseHg. I was asked to go from default working branch to production branch, write a piece of code, commit and push it there, then update back to default branch and con...

Why is an object file needed to generate an executable file?

linker executable object-files

When we compile code, an object file is generated. From that object file, an executable file is generated in the linking process.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.