From e62eb2e8d1937f1708ce7efdd6ab8a31e12c6f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= <jfd@butonic.de> Date: Thu, 20 Jun 2013 12:31:23 +0300 Subject: [PATCH] correctly handle error results of PDO and MDB2 backends --- lib/db.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/db.php b/lib/db.php index 4d6788f2bd..5e624bf30b 100644 --- a/lib/db.php +++ b/lib/db.php @@ -962,11 +962,14 @@ class OC_DB { * @return bool */ public static function isError($result) { - if(self::$backend==self::BACKEND_PDO and $result === false) { + //PDO returns false on error (and throws an exception) + if (self::$backend===self::BACKEND_PDO and $result === false) { return true; - }elseif(self::$backend==self::BACKEND_MDB2 and PEAR::isError($result)) { + } else + //MDB2 returns an MDB2_Error object + if (self::$backend===self::BACKEND_MDB2 and PEAR::isError($result)) { return true; - }else{ + } else { return false; } } -- GitLab