I am working with an application that we have added a custom error handler to. The reason we added this was so that we can be immediately notified and track issues in our application.
The problem here is that in debug mode, I have switched the error handler to print out all errors. The goal here being to eliminate all errors as they happen.
Now, I am trying to pull variables from a database that may or may not be serialized. So, the only way that I currently know of to detect if they are serialized, is to add a test. (IE if (unserialize($var)) { // do it }).
I can add the mute operator to the function call, but the custom error handler ignores it. Is there a way to detect whether the given error was muted? Or is there a better way to do this?
I am unable to modify database structure or data.
Actually, the “mute” operator will work just fine in this case. By checking the error reporting setting inside your custom error handler you can obey individual cases employing the
@suppression operator:If
error_reporting() === 0then the@suppression operator was used. As long as you check that value before launching into the rest of your handling routine you’ll be fine.