Skip to content

Commit

Permalink
minor #35473 [Cache] Don't allow mysqli to be used as it doesn't work…
Browse files Browse the repository at this point in the history
… (duncan3dc)

This PR was merged into the 4.3 branch.

Discussion
----------

[Cache] Don't allow mysqli to be used as it doesn't work

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

As discussed in #35375 Mysqli doesn't support named parameters, so if you pass a doctrine connection using `mysqli` then you get errors for any queries using named parameters.
This PR ensures a clear error is provided and suggests to use `pdo_mysql` instead

Commits
-------

a786448 Mysqli doesn't support the named parameters used by PdoAdapter
  • Loading branch information
nicolas-grekas committed Jan 27, 2020
2 parents d695b43 + a786448 commit 86ccf32
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Symfony/Component/Cache/Traits/PdoTrait.php
Expand Up @@ -395,6 +395,7 @@ private function getConnection()
} else {
switch ($this->driver = $this->conn->getDriver()->getName()) {
case 'mysqli':
throw new \LogicException(sprintf('The adapter "%s" does not support the mysqli driver, use pdo_mysql instead.', \get_class($this)));
case 'pdo_mysql':
case 'drizzle_pdo_mysql':
$this->driver = 'mysql';
Expand Down

0 comments on commit 86ccf32

Please sign in to comment.