I'm working on a script at the moment that reads in an HTML
template file, populates it with data and then saves the populated HTML
file as a cached copy in my cache folder.
I'm having real difficulties evaluating whether an error has occured with fopen()
while runtime errors are suppressed:
$file = @fopen($location,"w+");
// manual states fopen() returns false on error
// though the below does not catch any errors
if (!$file) {
$this->doSomething();
}
Is the suppression working against me? I would really appreciate some insight into this. I have tried setting error_reporting
to display no errors,
ini_set('display_errors',0);
ini_set('log_errors',1);
error_reporting(E_ALL);
and removed the supression from fopen()
but to no avail.
You code should work. If you never enter the if
statement and no errors are triggered, the file was opened successfully. Why are you sure that the fopen()
call failed?
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