I’ve faced some difficulty…
function generateExceptionOrError() {
throw new Exception();
}
Code below will display Fatal error: Uncaught exception 'Exception':
<? generateExceptionOrError();?>
Code below will also display Fatal error: Uncaught exception 'Exception':
<?=generateExceptionOrError();?>
But another code below will be silent and wouldn’t output any information about unhandled Excetions. It would display absolute nothing, blank page… Of course, I suppose that Exception is generated, but why it is not displayed!?
<link rel="stylesheet" href="<?=generateExceptionOrError();?>" type="text/css">
Why? What am I missing?
Thank you
UPDATED: There is not difference exception is generated in method or another kind of errors. The same situation.
One thing I’ve notice in testing is that if an exception occurs inside the
"‘s of an elements attribute, the entire element is not displayed as well as any output afterwards. It seems it might be a browsers/html quirk. Try running your script on the command line and see what output you get.Example:
Outputs:
Running this on the command line outputs:
Notice the
<link rel="stylesheet" href="which is what you would have expected.This could be at the root of your issue.