Vadammt Vadammt - 5 months ago 35
PHP Question

Control Operator Misused

I've got some PHP download script. Its last two lines are these:

header("Content-Length: ". @filesize($filename));
@readfile($filename);


NetBeans warns in both lines "Error Control Operator Misused". May I ignore this warning or how can I fix it?

Answer

Since you are already ignoring PHP warnings with @, I guess you could also ignore the NetBeans warnings.

More seriously, you should of course fix the problem :

  • Remove all these @ warning suppressors behind your function calls
  • Handle or avoid errors from these functions properly : Check if $filename exists and if you have the right to read from it before trying to read the size and output its content