|
@@ -296,7 +296,7 @@ class Database extends AbstractData
|
|
|
|
|
|
|
|
// create comment list
|
|
// create comment list
|
|
|
$comments = array();
|
|
$comments = array();
|
|
|
- if (is_array($rows) && count($rows)) {
|
|
|
|
|
|
|
+ if (count($rows)) {
|
|
|
foreach ($rows as $row) {
|
|
foreach ($rows as $row) {
|
|
|
$i = $this->getOpenSlot($comments, (int) $row['postdate']);
|
|
$i = $this->getOpenSlot($comments, (int) $row['postdate']);
|
|
|
$comments[$i] = Json::decode($row['data']);
|
|
$comments[$i] = Json::decode($row['data']);
|
|
@@ -386,7 +386,7 @@ class Database extends AbstractData
|
|
|
$fs = new Filesystem(array('dir' => 'data'));
|
|
$fs = new Filesystem(array('dir' => 'data'));
|
|
|
$value = $fs->getValue('salt');
|
|
$value = $fs->getValue('salt');
|
|
|
$this->setValue($value, 'salt');
|
|
$this->setValue($value, 'salt');
|
|
|
- @unlink($file);
|
|
|
|
|
|
|
+ unlink($file);
|
|
|
return $value;
|
|
return $value;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -467,7 +467,7 @@ class Database extends AbstractData
|
|
|
* @param array $params
|
|
* @param array $params
|
|
|
* @param bool $firstOnly if only the first row should be returned
|
|
* @param bool $firstOnly if only the first row should be returned
|
|
|
* @throws PDOException
|
|
* @throws PDOException
|
|
|
- * @return array|false
|
|
|
|
|
|
|
+ * @return array
|
|
|
*/
|
|
*/
|
|
|
private function _select($sql, array $params, $firstOnly = false)
|
|
private function _select($sql, array $params, $firstOnly = false)
|
|
|
{
|
|
{
|
|
@@ -475,6 +475,10 @@ class Database extends AbstractData
|
|
|
$statement->execute($params);
|
|
$statement->execute($params);
|
|
|
if ($firstOnly) {
|
|
if ($firstOnly) {
|
|
|
$result = $statement->fetch(PDO::FETCH_ASSOC);
|
|
$result = $statement->fetch(PDO::FETCH_ASSOC);
|
|
|
|
|
+ if ($this->_type === 'oci' && is_array($result)) {
|
|
|
|
|
+ // returned CLOB values are streams, convert these into strings
|
|
|
|
|
+ $result = array_map('PrivateBin\Data\Database::_sanitizeClob', $result);
|
|
|
|
|
+ }
|
|
|
} elseif ($this->_type === 'oci') {
|
|
} elseif ($this->_type === 'oci') {
|
|
|
// workaround for https://bugs.php.net/bug.php?id=46728
|
|
// workaround for https://bugs.php.net/bug.php?id=46728
|
|
|
$result = array();
|
|
$result = array();
|
|
@@ -485,12 +489,6 @@ class Database extends AbstractData
|
|
|
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
|
|
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
|
|
|
}
|
|
}
|
|
|
$statement->closeCursor();
|
|
$statement->closeCursor();
|
|
|
- if ($this->_type === 'oci' && is_array($result)) {
|
|
|
|
|
- // returned CLOB values are streams, convert these into strings
|
|
|
|
|
- $result = $firstOnly ?
|
|
|
|
|
- array_map('PrivateBin\Data\Database::_sanitizeClob', $result) :
|
|
|
|
|
- $result;
|
|
|
|
|
- }
|
|
|
|
|
return $result;
|
|
return $result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -763,7 +761,7 @@ class Database extends AbstractData
|
|
|
if ($this->_type === 'sqlite') {
|
|
if ($this->_type === 'sqlite') {
|
|
|
try {
|
|
try {
|
|
|
$row = $this->_select('SELECT sqlite_version() AS "v"', array(), true);
|
|
$row = $this->_select('SELECT sqlite_version() AS "v"', array(), true);
|
|
|
- $supportsDropColumn = version_compare($row['v'], '3.35.0', '>=');
|
|
|
|
|
|
|
+ $supportsDropColumn = (bool) version_compare($row['v'], '3.35.0', '>=');
|
|
|
} catch (PDOException $e) {
|
|
} catch (PDOException $e) {
|
|
|
$supportsDropColumn = false;
|
|
$supportsDropColumn = false;
|
|
|
}
|
|
}
|