RichardSisonFerrer / oauth

Automatically exported from code.google.com/p/oauth
0 stars 0 forks source link

php: Use of @ "error control operator" is considered bad pratice #155

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Can't find that many online references, but php devs often bring this up in
talks.
1. It's slow
2. It makes it hard to debug
3. It's often misued

In most cases in the oauth php code it's misued, and isset( $val ) ? $val :
false|null;  should have been used instead.

Attached is a patch that tries to fix it, some notes:
- It uses instanceOf, 1. this could have been enforced in function
signature instead. 2. this makes the code require php 5, should be ok by
now? Or maybe not (I noticed & is used on objects, hinting it was written
for php 4..)?
- Make sure you review the patch to make sure the intention of the @ use is
kept but without it.

Original issue reported on code.google.com by andre.ro...@gmail.com on 19 Apr 2010 at 2:23

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by morten.f...@gmail.com on 7 May 2010 at 3:27

GoogleCodeExporter commented 9 years ago
Removed all @'s from OAuth.php and the unit-tests as of revision 1231 and 
revision 1232. The @'s in the examples I didn't bother changing because the 
examples are old and should be updated anyways.

Thanks for reporting the issue and writing patches.

Original comment by morten.f...@gmail.com on 12 Jun 2010 at 8:31