News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

ThinkPHP Blog:
Silence of the LAMPs
September 16, 2009 @ 09:13:40

In a recent post to the ThinkPHP blog Martin Brotzeller looks at a PHP operator that developers should just not use anymore - the suppression operator (@).

The silence operator exists to give programmers an easy way to suppress messages when a command might fail and the code checks for success itself (i.e. in those cases that raise errors instead of throwing exceptions).

He points out a popular use (like putting it on an fopen to prevent it from throwing an E_WARNING) but notes that this could cause trouble if the code is several layers deep and seems to fail silently. He gives en example of the Zend_Loader component of the Zend Framework and how, if the suppression operator was used, errors with an include failed without so much as a blip in the error log. While it seems handy, the suppression operator can cause more harm than good in the long run.

0 comments voice your opinion now!
suppression operator avoid


blog comments powered by Disqus

Similar Posts

Mike Naberezny\'s Blog: pecl/operator and Other Neat Stuff

PHPMaster.com: Avoid the Original MySQL Extension, Part 1

WebReference.com: Unary, Binary, and Ternary Operators in PHP

Community News: Namespace Operator Debate Ends with Backslash

IBM developerWorks: Mastering regular expressions in PHP, Part 1


Community Events

Don't see your event here?
Let us know!


performance application example podcast introduction conference php7 api opinion community series release interview language symfony2 laravel voicesoftheelephpant configure part2 framework

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework