ConnectionHelper results in AssertionError
stefantalen opened this issue · 1 comments
stefantalen commented
Running this in the Dockerphp:7.4-apache
image with dblib configured.
PHP: 7.4.12
Symfony: 5.2.3
MSSQL: 12.00.6118
After running the command bin/console dbal:run-sql "SELECT TOP 1 * FROM table
I get this response:
In PDOConnection.php line 53:
[AssertionError (1)]
assert($result !== false)
Exception trace:
at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:53
assert() at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:53
Doctrine\DBAL\Driver\PDOConnection->exec() at /var/www/html/vendor/mediamonks/mssql-bundle/Helper/ConnectionHelper.php:16
MediaMonks\MssqlBundle\Helper\ConnectionHelper::setConnectionOptions() at /var/www/html/vendor/mediamonks/mssql-bundle/Doctrine/DBAL/Driver/PDODblib/Driver.php:70
MediaMonks\MssqlBundle\Doctrine\DBAL\Driver\PDODblib\Driver->connectUnix() at /var/www/html/vendor/mediamonks/mssql-bundle/Doctrine/DBAL/Driver/PDODblib/Driver.php:34
MediaMonks\MssqlBundle\Doctrine\DBAL\Driver\PDODblib\Driver->connect() at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:362
Doctrine\DBAL\Connection->connect() at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1853
Doctrine\DBAL\Connection->getWrappedConnection() at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1241
Doctrine\DBAL\Connection->executeQuery() at /var/www/html/vendor/mediamonks/mssql-bundle/Doctrine/DBAL/Connection.php:17
MediaMonks\MssqlBundle\Doctrine\DBAL\Connection->executeQuery() at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:978
Doctrine\DBAL\Connection->fetchAllAssociative() at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php:91
Doctrine\DBAL\Tools\Console\Command\RunSqlCommand->execute() at /var/www/html/vendor/symfony/console/Command/Command.php:256
Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:989
Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:96
Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:290
Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:82
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/html/vendor/symfony/console/Application.php:166
Symfony\Component\Console\Application->run() at /var/www/html/bin/console:43
This is triggered when the ConnectionHelper starts running this query:
$connection->exec('SET ANSI_WARNINGS ON');
As a workaround I've created my own class extending MediaMonks\MssqlBundle\Doctrine\DBAL\Driver\PDODblib\Driver
and overwriting the connectUnix
method to exclude ConnectionHelper::setConnectionOptions($connection);
stefantalen commented
Just use the official Microsoft extension through pdo_sqlsrv
instead of this bundle 🙂