mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-03-22 13:10:41 +08:00
fix unit tests on php < 7.3
This commit is contained in:
parent
68b097087d
commit
078c5785dd
|
@ -233,11 +233,14 @@ class Database extends AbstractData
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$_cache[$pasteid] = false;
|
self::$_cache[$pasteid] = false;
|
||||||
$paste = self::_select(
|
try {
|
||||||
'SELECT * FROM ' . self::_sanitizeIdentifier('paste') .
|
$paste = self::_select(
|
||||||
' WHERE dataid = ?', array($pasteid), true
|
'SELECT * FROM ' . self::_sanitizeIdentifier('paste') .
|
||||||
);
|
' WHERE dataid = ?', array($pasteid), true
|
||||||
|
);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$paste = false;
|
||||||
|
}
|
||||||
if ($paste === false) {
|
if ($paste === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -643,15 +646,18 @@ class Database extends AbstractData
|
||||||
* @access private
|
* @access private
|
||||||
* @static
|
* @static
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @throws PDOException
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private static function _getConfig($key)
|
private static function _getConfig($key)
|
||||||
{
|
{
|
||||||
$row = self::_select(
|
try {
|
||||||
'SELECT value FROM ' . self::_sanitizeIdentifier('config') .
|
$row = self::_select(
|
||||||
' WHERE id = ?', array($key), true
|
'SELECT value FROM ' . self::_sanitizeIdentifier('config') .
|
||||||
);
|
' WHERE id = ?', array($key), true
|
||||||
|
);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
return $row ? $row['value'] : '';
|
return $row ? $row['value'] : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -259,6 +259,7 @@ class ModelTest extends PHPUnit_Framework_TestCase
|
||||||
$paste = $model->getPaste();
|
$paste = $model->getPaste();
|
||||||
$paste->setData($pasteData);
|
$paste->setData($pasteData);
|
||||||
$paste->store();
|
$paste->store();
|
||||||
|
$paste->exists();
|
||||||
|
|
||||||
$db = new PDO(
|
$db = new PDO(
|
||||||
$options['model_options']['dsn'],
|
$options['model_options']['dsn'],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user