I'm struggling for an hour, trying to figure out why is PHP showing errors although I suppressed them at the very begginging of my code like this:
error_reporting(E_ALL);
ini_set('log_errors', 1);
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
I want to log all PHP errors but I don't want to show any of them to the user as this is code for the production.
At the end of the PHP file I check if the ini is set correctly with ini_get('display_errors')
and it returns 0
as expected.
I also check my whole project and there is no other ini_set() function called, which could override this setting.
Why am I still getting Undefined variable shown to the user?
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: Notice</p>
<p>Message: Undefined variable: fb_admin</p>
<p>Filename: fb_app/header.php</p>
<p>Line Number: 173</p>
</div>
This is getting frustrating so thanks for any help :)
Edit: Of course I'm aware that I should fix this error, but that's not the point. The point is how to correctly handle other similar, unpredictable errors. I want to log them but not to show them.