Coding Standards : misuse of the @ error control operator
| From: | Frederic Poeydomenge | Date: | Thu, 24 Apr 2003 10:06:10 +0000 |
| Subject: | Coding Standards : misuse of the @ error control operator | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-15449@lists.php.net to get a copy of this message | ||
Hi all,
I didn't see any reference in the PEAR Coding Standards to the use of the @
error control operator, and I would like to have your opinions...
This operator is certainly a powerful language construction, but IMHO I think it
can be misused, and should not be used to hide some bad design.
For example, in BBCodeParser.php (sorry Stijn I had the pb on this script !)
there is an instructions :
$nextOpenPos = @strpos($str, $this->_options['open'], $openPos + 1);
that produce an alert (with error_reporting = E_ALL in my php.ini) because
$openPos is initialized with the length of the string, and $openPos + 1 is
outside the string :
Alerte [2] offset not contained in string in
/usr/share/pear/HTML/BBCodeParser.php line 289
But it should be more correct to check the argument before using it, don't you
think ?
Regards,
--------------------
Frederic Poeydomenge