aboutsummaryrefslogtreecommitdiffstats
path: root/include/dba
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2025-01-12 21:43:48 +0100
committerHarald Eilertsen <haraldei@anduin.net>2025-01-29 12:42:44 +0100
commit4625ffa6b410f059f2629fabd85f6c8077babcbd (patch)
tree74494d8d9205835f2230884352f5f97e56c24740 /include/dba
parent3e6a646603ccec33e532575c5d6319144dbc8c41 (diff)
downloadvolse-hubzilla-4625ffa6b410f059f2629fabd85f6c8077babcbd.tar.gz
volse-hubzilla-4625ffa6b410f059f2629fabd85f6c8077babcbd.tar.bz2
volse-hubzilla-4625ffa6b410f059f2629fabd85f6c8077babcbd.zip
Fix return value from dba_pdo::q()
According to the documentation, this function should never return null. Still that's what it did if a non-select query raised a PDOException. This patch fixes this, so that it so that the function conforms to the docs.
Diffstat (limited to 'include/dba')
-rw-r--r--include/dba/dba_pdo.php6
1 files changed, 1 insertions, 5 deletions
diff --git a/include/dba/dba_pdo.php b/include/dba/dba_pdo.php
index fc10fee56..503b71233 100644
--- a/include/dba/dba_pdo.php
+++ b/include/dba/dba_pdo.php
@@ -73,7 +73,7 @@ class dba_pdo extends dba_driver {
}
}
- $result = null;
+ $result = false;
$this->error = '';
$select = stripos($sql, 'select') === 0 || stripos($sql, 'returning ') > 0;
@@ -162,10 +162,6 @@ class dba_pdo extends dba_driver {
db_logger('dba_pdo: PDOStatement returned, did not expect that.');
return false;
}
- } elseif ($res === null) {
- // While `q` should never return null, that's exactly what it
- // does when the insert fails. Let's turn it to a false instead.
- $res = false;
}
if (is_array($res)) {