summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-06-20 12:31:23 +0300
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-06-28 20:16:01 +0200
commite62eb2e8d1937f1708ce7efdd6ab8a31e12c6f28 (patch)
tree461b83c7c6687e272c8a406ce620dc7b248edd67
parent7b6fcddbc5314e7401e4f5579853aa6353d462f9 (diff)
downloadnextcloud-server-e62eb2e8d1937f1708ce7efdd6ab8a31e12c6f28.tar.gz
nextcloud-server-e62eb2e8d1937f1708ce7efdd6ab8a31e12c6f28.zip
correctly handle error results of PDO and MDB2 backends
-rw-r--r--lib/db.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/db.php b/lib/db.php
index 4d6788f2bda..5e624bf30b9 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;
}
}