Didn't check return value of select #17

Closed
wants to merge 2 commits into
from

Projects

None yet

3 participants

@hexmode
hexmode commented Jan 22, 2013

select can return false.

@brandonsavage

You can test for false.

if ($res === false)

Note the three equals signs. This tests for type and value equality.

Owner

Yes, but an db object won't evaluate as false, so this is safe. I've nothing against the === operator if you prefer that, though.

Contributor
reedy commented Mar 30, 2013
 * @return ResultWrapper. If the query returned no rows, a ResultWrapper
 *   with no rows in it will be returned. If there was a query error, a
 *   DBQueryError exception will be thrown, except if the "ignore errors"
 *   option was set, in which case false will be returned.

For MediaWiki usage, you're really only going to get a ResultWrapper object or false. If it throws an exception we don't care what the return value is anyway

Collaborator

Cannot be automatically merged. r- until resubmitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment