Re:Five reasons why the PHP silence operator @ should be avo...
by pekk on Thursday January 10, 2013 @12:13PM
(#5038173)
This flags a design flaw, perhaps in mysql_connect. If a warning is trivial enough that it's reasonable to silence, it shouldn't exist. Otherwise, it's not reasonable to silence it!
I find it hard to believe that this is actually considered acceptable.
Re:Five reasons why the PHP silence operator @ should be avo...
by jiggy2011 on Thursday January 10, 2013 @12:21PM
(#5038252)
Surely that depends on your application, in 99.9% of cases where you are using LAMP to host some site a failed mysql_connect is probably an epic fail condition.
My point is rather that there may certainly be applications where this is not the case.
This is an area where exceptions are better than dumb warnings.
Re:Five reasons why the PHP silence operator @ should be avo...
by astrodust on Thursday January 10, 2013 @01:59PM
(#5038966)
Using mysql_query is an epic fail condition. Period.
Re:Five reasons why the PHP silence operator @ should be avo...
by jtreminio on Thursday January 10, 2013 @12:37PM
(#5038392)
Don't use mysql_*. Says so right in the docs. PDO can be used with try/catch.
Re:Five reasons why the PHP silence operator @ should be avo...
by justinator on Thursday January 10, 2013 @01:52PM
(#5038925)
You might be developing an application that functions in some P2P type fashion or is specifically intended to be used in situations where network access will be intermittent (on a boat perhaps?).
In such a case a mysql_connect call may have a high chance of failing and your application is designed in such a way as to assume that this is likely (i.e working with the return code). In such a case failing the connection is not an error but expected behaviour.