{"action":"closed","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/8017","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/8017/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/8017/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/8017/events","html_url":"https://github.com/yiisoft/yii2/issues/8017","id":67077534,"number":8017,"title":"PDO exception when loading test fixtures and using Mysql init commands","user":{"login":"ivokund","id":2707429,"avatar_url":"https://avatars.githubusercontent.com/u/2707429?v=3","gravatar_id":"","url":"https://api.github.com/users/ivokund","html_url":"https://github.com/ivokund","followers_url":"https://api.github.com/users/ivokund/followers","following_url":"https://api.github.com/users/ivokund/following{/other_user}","gists_url":"https://api.github.com/users/ivokund/gists{/gist_id}","starred_url":"https://api.github.com/users/ivokund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivokund/subscriptions","organizations_url":"https://api.github.com/users/ivokund/orgs","repos_url":"https://api.github.com/users/ivokund/repos","events_url":"https://api.github.com/users/ivokund/events{/privacy}","received_events_url":"https://api.github.com/users/ivokund/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yiisoft/yii2/labels/type:docs","name":"type:docs","color":"207de5"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/yiisoft/yii2/milestones/9","html_url":"https://github.com/yiisoft/yii2/milestones/2.0.x","labels_url":"https://api.github.com/repos/yiisoft/yii2/milestones/9/labels","id":831720,"number":9,"title":"2.0.x","description":"","creator":{"login":"cebe","id":189796,"avatar_url":"https://avatars.githubusercontent.com/u/189796?v=3","gravatar_id":"","url":"https://api.github.com/users/cebe","html_url":"https://github.com/cebe","followers_url":"https://api.github.com/users/cebe/followers","following_url":"https://api.github.com/users/cebe/following{/other_user}","gists_url":"https://api.github.com/users/cebe/gists{/gist_id}","starred_url":"https://api.github.com/users/cebe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cebe/subscriptions","organizations_url":"https://api.github.com/users/cebe/orgs","repos_url":"https://api.github.com/users/cebe/repos","events_url":"https://api.github.com/users/cebe/events{/privacy}","received_events_url":"https://api.github.com/users/cebe/received_events","type":"User","site_admin":false},"open_issues":333,"closed_issues":2,"state":"open","created_at":"2014-10-19T13:49:45Z","updated_at":"2015-04-24T08:44:19Z","due_on":null,"closed_at":null},"comments":11,"created_at":"2015-04-08T08:32:33Z","updated_at":"2015-04-24T08:44:19Z","closed_at":"2015-04-24T08:44:19Z","body":"I have run into a strange issue. When I add more than one `PDO::MYSQL_ATTR_INIT_COMMAND` commands in my configuration, like this:\r\n\r\n```php\r\n'db' => [\r\n    'class' => 'yii\\db\\Connection',\r\n    'charset' => 'utf8',\r\n    'attributes' => [\r\n        PDO::MYSQL_ATTR_INIT_COMMAND => '\r\n            SET SESSION sql_mode = \\'STRICT_TRANS_TABLES\\';\r\n            SET SESSION time_zone = \\'+0:00\\';\r\n        '\r\n    ]\r\n],\r\n```\r\n\r\nThen I get the following error when running codeception functional tests that try to load global fixtures.\r\n\r\n```\r\n:~/clone/tests/codeception/frontend$ codecept run --debug\r\n\r\n\r\n  [PDOException]\r\n  SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active.  Consid\r\n  er using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you m\r\n  ay enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.\r\n\r\n\r\nException trace:\r\n () at [path]/vendor/yiisoft/yii2/db/Connection.php:597\r\n PDO->exec() at [path]/vendor/yiisoft/yii2/db/Connection.php:597\r\n yii\\db\\Connection->initConnection() at [path]/vendor/yiisoft/yii2/db/Connection.php:530\r\n yii\\db\\Connection->open() at [path]/vendor/yiisoft/yii2/db/Connection.php:837\r\n yii\\db\\Connection->getMasterPdo() at [path]/vendor/yiisoft/yii2/db/Connection.php:824\r\n yii\\db\\Connection->getSlavePdo() at [path]/vendor/yiisoft/yii2/db/Command.php:208\r\n yii\\db\\Command->prepare() at [path]/vendor/yiisoft/yii2/db/Command.php:816\r\n yii\\db\\Command->queryInternal() at [path]/vendor/yiisoft/yii2/db/Command.php:350\r\n yii\\db\\Command->queryAll() at [path]/vendor/yiisoft/yii2/db/mysql/Schema.php:198\r\n yii\\db\\mysql\\Schema->findColumns() at [path]/vendor/yiisoft/yii2/db/mysql/Schema.php:97\r\n yii\\db\\mysql\\Schema->loadTableSchema() at [path]/vendor/yiisoft/yii2/db/Schema.php:140\r\n yii\\db\\Schema->getTableSchema() at [path]/vendor/yiisoft/yii2/test/ActiveFixture.php:146\r\n yii\\test\\ActiveFixture->getTableSchema() at [path]/vendor/yiisoft/yii2/test/ActiveFixture.php:121\r\n yii\\test\\ActiveFixture->resetTable() at [path]/vendor/yiisoft/yii2/test/ActiveFixture.php:76\r\n yii\\test\\ActiveFixture->load() at [path]/vendor/yiisoft/yii2/test/FixtureTrait.php:93\r\n tests\\codeception\\common\\_support\\FixtureHelper->loadFixtures() at [path]/tests/codeception/common/_support/FixtureHelper.php:72\r\n tests\\codeception\\common\\_support\\FixtureHelper->_beforeSuite() at /home/rof/.composer/vendor/codeception/codeception/src/Codeception/Subscriber/Module.php:32\r\n Codeception\\Subscriber\\Module->beforeSuite() at n/a:n/a\r\n call_user_func() at /home/rof/.composer/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:164\r\n Symfony\\Component\\EventDispatcher\\EventDispatcher->doDispatch() at /home/rof/.composer/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:53\r\n Symfony\\Component\\EventDispatcher\\EventDispatcher->dispatch() at /home/rof/.composer/vendor/codeception/codeception/src/Codeception/SuiteManager.php:152\r\n Codeception\\SuiteManager->run() at /home/rof/.composer/vendor/codeception/codeception/src/Codeception/Codecept.php:166\r\n Codeception\\Codecept->runSuite() at /home/rof/.composer/vendor/codeception/codeception/src/Codeception/Codecept.php:149\r\n Codeception\\Codecept->run() at /home/rof/.composer/vendor/codeception/codeception/src/Codeception/Command/Run.php:262\r\n Codeception\\Command\\Run->runSuites() at /home/rof/.composer/vendor/codeception/codeception/src/Codeception/Command/Run.php:191\r\n Codeception\\Command\\Run->execute() at /home/rof/.composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257\r\n Symfony\\Component\\Console\\Command\\Command->run() at /home/rof/.composer/vendor/symfony/console/Symfony/Component/Console/Application.php:874\r\n Symfony\\Component\\Console\\Application->doRunCommand() at /home/rof/.composer/vendor/symfony/console/Symfony/Component/Console/Application.php:195\r\n Symfony\\Component\\Console\\Application->doRun() at /home/rof/.composer/vendor/symfony/console/Symfony/Component/Console/Application.php:126\r\n Symfony\\Component\\Console\\Application->run() at /home/rof/.composer/vendor/codeception/codeception/codecept:27\r\n```\r\n\r\nAny idea what could be using the problem? The issue only happens on Codeship CI server and with any two commands in the configuration. When I remove any one, the issue dissapears. \r\n\r\nSetting `PDO::MYSQL_ATTR_USE_BUFFERED_QUERY` to true did not help. Also setting `emulatePrepare` to true did not help. \r\n\r\n```\r\nYii 2.0.3\r\nPDO::ATTR_CLIENT_VERSION: mysqlnd 5.0.11-dev - 20120503\r\nPDO::ATTR_DRIVER_NAME: mysql\r\nPDO::ATTR_SERVER_VERSION: 5.6.19-0ubuntu0.14.04.1\r\n```\r\n\r\nThanks! "}}