diff --git a/lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php b/lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php index 856c1a29a9d..e979003ba2f 100644 --- a/lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php +++ b/lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php @@ -72,8 +72,8 @@ protected function execute(Console\Input\InputInterface $input, Console\Output\O throw new \LogicException("Option 'depth' must contains an integer value"); } - if (preg_match('/^select/i', $sql)) { - $resultSet = $conn->fetchAll($sql); + if (stripos($sql, 'select') === 0) { + $resultSet = $conn->fetchAll($sql); } else { $resultSet = $conn->executeUpdate($sql); }