I develop in Vagrant VM with Ubuntu 12.04 and php 5.5.7. and faced problem of incorrect error reporting handling in this case: @-sign works incorrectly.
When using custom error handlers and globally turned on error reporting, @-calls (such as @unlink('...')
) should trigger custom handler but calling error_reporting()
from it should return 0 in this case:
http://ca3.php.net/manual/en/language.operators.errorcontrol.php
If you have set a custom error handler function with set_error_handler() then it will still get called, but this custom error handler can (and should) call error_reporting() which will return 0 when the call that triggered the error was preceded by an @.
But in fact it returns -1!
Googling have not resulted in anything.
Have anyone any idea, how to make it work correctly? And what can cause this?
UPD
The question is not about using or not using of @-sign. Even if I don't use it, vendors of third-party packages use it. And don't tell me that this packages are bad because of it, you will be wrong. In some situations, when using @ wisely, it can fix issues caused by bad design of old native php functions that produce warnings in places where they should not. But this is a hollywar and doesn't matter in question context.
The question is about making it work correctly in given environment and localization of issue source
UPD2
Problem was found, see accepted answer