[HttpKernel] Fix issue in SQLite profiler storage when PDO fails to prepare a statement
This commit is contained in:
parent
93fd935b70
commit
2201382fa1
@ -146,6 +146,11 @@ class SQLiteProfilerStorage implements ProfilerStorageInterface
|
|||||||
protected function exec($db, $query, array $args = array())
|
protected function exec($db, $query, array $args = array())
|
||||||
{
|
{
|
||||||
$stmt = $db->prepare($query);
|
$stmt = $db->prepare($query);
|
||||||
|
|
||||||
|
if (false === $stmt) {
|
||||||
|
throw new \RuntimeException('The database cannot successfully prepare the statement');
|
||||||
|
}
|
||||||
|
|
||||||
if ($db instanceof \SQLite3) {
|
if ($db instanceof \SQLite3) {
|
||||||
foreach ($args as $arg => $val) {
|
foreach ($args as $arg => $val) {
|
||||||
$stmt->bindValue($arg, $val, is_int($val) ? \SQLITE3_INTEGER : \SQLITE3_TEXT);
|
$stmt->bindValue($arg, $val, is_int($val) ? \SQLITE3_INTEGER : \SQLITE3_TEXT);
|
||||||
|
Reference in New Issue
Block a user