Feature proposal

php.internals

Wojtek Meler

23 years ago
I have to fight with people that using error suppression operator - they just hide their bugs. I wrote simple patch that allows set disable_error_suppression=On in php.ini that causes engine to ignore '@' operators. http://strony.wp.pl/wp/wmeler/error_suppression.patch.txt Regards, Wojtek

Mike Robinson

23 years ago
No offense, but I see this feature as a bad thing in so many ways and on so many levels my skin is crawling. :) Regards Mike Robinson http://fiddy8.com/

Ken Tossell

23 years ago
>>I have to fight with people that using error suppression operator - they >>just hide their bugs. >>I wrote simple patch that allows set disable_error_suppression=On in >>php.ini that causes engine to ignore '@' operators. >> >>
But often errors/warnings are *not* bugs. Or maybe you don't want to show your users the ugly messages from something like include -- if (!@include 'foo.php') die('Couldn\'t..'); Ken

Wojtek Meler

23 years ago
Ken Tossell wrote:
> But often errors/warnings are *not* bugs. Or maybe you don't want to > show your users the ugly messages from something like include -- if > (!@include 'foo.php') die('Couldn\'t..');
Well it is true. Sometimes it is needed and that's why this functionality is turned off by default. But sometimes you are searching for hours something that is little '@' before call to undefined function - script crashes and you don't know where. All what you have is 'grep' on all sources, filter email adresses etc. http://www.php.net/manual/en/language.operators.errorcontrol.php : *Warning* Currently the "@" error-control operator prefix will even disable error reporting for critical errors that will terminate script execution. Among other things, this means that if you use "@" to suppress errors from a certain function and either it isn't available or has been mistyped, the script will die right there with no indication as to why.
>>> http://strony.wp.pl/wp/wmeler/error_suppression.patch.txt >>
This account has funny restrictions - try go through http://strony.wp.pl/wp/wmeler/.

Timm Friebe

23 years ago
On Tue, 2003-07-22 at 19:48, Wojtek Meler wrote:
> I have to fight with people that using error suppression operator - they > just hide their bugs. > I wrote simple patch that allows set disable_error_suppression=On in > php.ini that causes engine to ignore '@' operators.
Use set_error_handler(), then; the callback function is called regardless whether the error suppression "operator" @ was used. thekid@friebes:~ > php -r 'function handler() { var_dump(array_pop(array_slice($a= func_get_args(), 1, 1))); } set_error_handler("handler"); @include("foo");' ^^^^^^^^^^^^^^^ string(64) "Unknown(foo): failed to create stream: No such file or directory" string(116) "Unknown(): Failed opening 'foo' for inclusion (include_path='.:/home/thekid/devel/xp/skeleton:/home/thekid/classes')" - Timm

Wojtek Meler

23 years ago
Timm Friebe wrote:
> On Tue, 2003-07-22 at 19:48, Wojtek Meler wrote: > >>I have to fight with people that using error suppression operator - they >>just hide their bugs. >>I wrote simple patch that allows set disable_error_suppression=On in >>php.ini that causes engine to ignore '@' operators. > > > Use set_error_handler(), then; the callback function is called > regardless whether the error suppression "operator" @ was used. > > thekid@friebes:~ > php -r 'function handler() { > var_dump(array_pop(array_slice($a= func_get_args(), 1, 1))); } > set_error_handler("handler"); @include("foo");' > ^^^^^^^^^^^^^^^ > > string(64) "Unknown(foo): failed to create stream: No such file or > directory" > string(116) "Unknown(): Failed opening 'foo' for inclusion > (include_path='.:/home/thekid/devel/xp/skeleton:/home/thekid/classes')" > > - Timm > >
but try this : php -r 'function handler() { var_dump(array_pop(array_slice($a= func_get_args(), 1, 1))); } set_error_handler("handler"); @nonexist();echo "and now what?";' regards Wojtek

Cristiano Duarte

23 years ago
Sorry, but didn't all there error/warnings/info got logged if you want ? I think you can set loggin on in php.ini and IMHO that's the best place to dig for bugs... Cristiano Duarte. "Wojtek Meler" <wmeler@wp-sa.pl> escreveu na mensagem news:3F1E41A8.6040106@wp-sa.pl...