Fix type error in DBHelper::query() when there is a query error

This commit is contained in:
Kijin Sung 2023-01-16 21:39:30 +09:00
parent c07efe7905
commit 0ba4c51c3c

View file

@ -86,10 +86,10 @@ class DBHelper extends \PDO
* *
* @param string $statement * @param string $statement
* @param int $fetch_mode * @param int $fetch_mode
* @return DBStmtHelper * @return DBStmtHelper|false
*/ */
#[\ReturnTypeWillChange] #[\ReturnTypeWillChange]
public function query(string $statement, ?int $fetch_mode = \PDO::FETCH_OBJ, ...$fetch_mode_args): DBStmtHelper public function query(string $statement, ?int $fetch_mode = \PDO::FETCH_OBJ, ...$fetch_mode_args)
{ {
$start_time = microtime(true); $start_time = microtime(true);
$db_class = DB::getInstance($this->_type); $db_class = DB::getInstance($this->_type);
@ -110,6 +110,7 @@ class DBHelper extends \PDO
} }
catch (\PDOException $e) catch (\PDOException $e)
{ {
$stmt = false;
$db_class->setError(-1, $e->getMessage()); $db_class->setError(-1, $e->getMessage());
} }
finally finally