From 8d6392192428d6a0099fa0cc29ec8c52d7c99deb Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 23 Jan 2022 21:24:28 +0100 Subject: [PATCH] workaround bug in OCI PDO driver --- lib/Data/Database.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/Data/Database.php b/lib/Data/Database.php index d0616a7..1e9adea 100644 --- a/lib/Data/Database.php +++ b/lib/Data/Database.php @@ -583,9 +583,17 @@ class Database extends AbstractData { $statement = self::$_db->prepare($sql); $statement->execute($params); - $result = $firstOnly ? - $statement->fetch(PDO::FETCH_ASSOC) : - $statement->fetchAll(PDO::FETCH_ASSOC); + if ($firstOnly) { + $result = $statement->fetch(PDO::FETCH_ASSOC); + } elseif (self::$_type === 'oci') { + // workaround for https://bugs.php.net/bug.php?id=46728 + $result = array(); + while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { + $result[] = $row; + } + } else { + $result = $statement->fetchAll(PDO::FETCH_ASSOC); + } $statement->closeCursor(); if (self::$_type === 'oci' && is_array($result)) { // returned column names are all upper case, convert these back