I’m using dompdf to generate pdf’s to send as an attachment with e-mails, the problem is I can’t send the e-mail before the pdf was generated (for obvious reasons, you can’t attach something that doesn’t exists).
Now my problem is, I don’t want to send the e-mail until the file exists, I couldn’t find a callback method for dompdf (maybe I’m blind) so I tried doing something with file_exists.
However, when I have 2 lines of code, the top one having
echo file_exists($file);
and the bottom one having
$f = fopen($file, ‘rb’);
I get returned a 1 from the first, indicating the file exists. But after that I get a reading error that says the file doesn’t exists…
Is there any way to check if a function will return an error without it actually returning the error?