Closed MDBenson closed 3 years ago
When the function throws a Fatal error
you cannot catch it with an expection. If it's a Notice, you can change the error_reporting to exclude notices and silence the error with an @ prefix. I found similar issues on SO about imap... maybe this helps:
https://stackoverflow.com/questions/42223245/imap-open-custom-error-callback?rq=1
https://stackoverflow.com/questions/5422405/cant-silence-imap-open-error-notices-in-php
Hi,
I am trying to integrate IMAP features into an established FatFree 3.6 project and am running into a problem. Upon failure to connect, imap_open() throws a WARNING level message as below:
I can't see that this error is trappable using a try/catch as it's not an Exception. All my attempts to trap and report it so far have failed and my script stops on a 500 Internal Server Error genrated by FatFree's Error Handler (Base::error()). Is there any way to configure FatFree so I can handle this better? I would prefer this failed to a graceful Exception that I could trap and return to the user.
My only solution so far is to set then restore the error handler thus:
But this is a bit clunky and also impractical as I am using a composer package (https://github.com/barbushin/php-imap) for PHP IMAP functions and editing the package files becomes a problem for future updates to the php-imap package.