I can't seem to disable error reporting in PHP - I have tried everything but "Notice" errors are still displayed.
My php.ini has
display_errors = Off;
error_reporting = 0;
My .htaccess has
php_value error_reporting 0
And my script has
ini_set('display_errors', 'Off');
ini_set('log_errors', 1);
ini_set('error_reporting', 0);
ini_set('display_startup_errors', 'Off');
php_info();
echo $my_undefined_var;
The php_info() output confirms that display_errors and error_reporting are indeed off and 0, and yet I still get a notice,
Notice: Undefined variable: my_undefined_var in /my/site/path/index.php?blahblah...
Note this is an OpenCart website (and my change is in the Admin section). I have tried creating a test php script in the same directory as index.php and it's fine.
Is there anything else that could be overriding the error_reporting(0)
?
I've done a grep of the entire site to find and disable all mentions of the error_reporting and display_errors but to no avail.
There is a setting within the OpenCart dashboard that allows you to turn on (or off) error reporting and logging.
As @colmde already pointed OpenCart uses custom error_handler.
You can turn error displaying off without any code edits (especially OpenCart core files) via:
Admin->System->Settings->[edit your configured store]->Server->Display Errors
[EDIT] You can do the same by running following query against OpenCart database:
update setting set `value`= 1 where `key` = 'config_error_display'
OpenCart uses the set_error_handler()
function which causes it to override the error_reporting(0)
.
Removing this fixed my problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With