An unexpected error occurred #" for errors.
3 posts by 2 authors in: Forums > CMS Builder
Last Post: February 11, 2022 (RSS)
By pacolvin - February 4, 2022
We are running a Login Script from Sitelok for our pages that only members have access to. They need to support older versions of PHP so some of their code will throw a depreciated error. I have no problem with these errors being logged in the developer log, but I need to suppress any message from being displayed on the page. I have the box checked to Hide all warnings, but of course it shows the "An unexpected error occurred".
Is there any way to hide this message as well? I know the error exists, but since they need to support older versions, they can't change their code. I know we want to have error free code, but sometimes that is not under our control.
Thanks
Phil Colvin
By daniel - February 10, 2022
Hi Phil,
It's possible to adjust the errors which display by using the error_reporting() function. To turn off only the deprecated warnings, you can use this:
error_reporting(E_ALL ^ E_DEPRECATED);
Or to suppress all errors/notices/warnings, you can use this:
error_reporting(0);
Note that you will need to include this in your code after the CMSB viewer library has been loaded.
Let me know if you have any other questions!
Thanks,
Technical Lead
interactivetools.com
Thanks for the response.
error_reporting(E_ALL ^ E_DEPRECATED);
Did not suppress the error, but the error_reporting(0) did.
Phil