In many cases PDO methods return false on error rather than null when nothing is returned. So my code does…

$stmt = $dbh->prepare(“Some SQL”);
if (($stmt !== false) && $stmt->execute(…)) {
$rows = $stmt->fetch(…);
if ($rows !== false) {
while …

Unfortunately I’ve found one place where a null is returned when it should be false. :-(