DoctrineBundle: BC break between 1.6.7 -> 1.6.8 regarding driver selection
After upgrading from 1.6.7 to 1.6.8, all our tests started failing. While investigating, found that DBAL driver is somehow not picked up correctly. All functional tests failing with:
Doctrine\DBAL\Exception\DriverException: An exception occured in driver: could not find driver
It suddenly tries to load pdo_mysql instead of pdo_pgsql.
Bisected this breakage to commit 99a62a7c4139c0ccb6969de5eff1447b1a6cbaf4.
This is what our DBAL config looks like:
doctrine:
dbal:
default_connection: xxx
connections:
xxx:
server_version: 9.4
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
mapping_types:
bit: boolean
tsvector: string
types:
foo:
class: X\Y\Types\FooType # <-- commented type
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 8
- Comments: 20 (8 by maintainers)
Links to this issue
Commits related to this issue
- Revert "Fix an issue were some commented type (#623)" This reverts commit 99a62a7c4139c0ccb6969de5eff1447b1a6cbaf4. There where some issues with the database driver configuration. You can follow the ... — committed to sebastianfeldmann/DoctrineBundle by deleted user 7 years ago
- Revert "Fix an issue were some commented type (#623)" This reverts commit 99a62a7. There was an issue with the database driver configuration. You can see the whole discussion here: https://github.co... — committed to sebastianfeldmann/DoctrineBundle by sebastianfeldmann 7 years ago
- Enhance exception message The error occures if doctrine needs to establish a connection to determine the platform version to register the types. The idea is to provide some more information so the us... — committed to sebastianfeldmann/DoctrineBundle by sebastianfeldmann 7 years ago
- Enhance exception message The error occures if doctrine needs to establish a connection to determine the platform version to register the types. The idea is to provide some more information so the us... — committed to sebastianfeldmann/DoctrineBundle by sebastianfeldmann 7 years ago
- Enhance exception message The error occures if doctrine needs to establish a connection to determine the platform version to register the types. The idea is to provide some more information so the us... — committed to sebastianfeldmann/DoctrineBundle by sebastianfeldmann 7 years ago
- Enhance exception message The error we want to improve occures if doctrine needs to establish a connection to determine the platform version to register the types. The idea is to provide some more in... — committed to sebastianfeldmann/DoctrineBundle by sebastianfeldmann 7 years ago
- Catch Doctrine's DBALException of the database connection fails On step 4 of the installer, the database variables are guessed from the URL of the website. Fork then tries to connect to this database... — committed to forkcms/forkcms by StijnVrolijk 6 years ago
- BAP-12799: Upgrade of the 3rd party dependencies to the latest stable… (#18487) * BAP-12799: Upgrade of the 3rd party dependencies to the latest stable version - updated doctrine - updated compile... — committed to videni/OroBatchBundle by anyt 6 years ago
- Add server version because of https://github.com/doctrine/DoctrineBundle/issues/673 — committed to InsaLan/insalan.fr by AntoineBvn 5 years ago
- failing uuid https://github.com/doctrine/DoctrineBundle/issues/673 — committed to TheSoftwareHouse/fogger by tsurowiec 6 years ago
- BAP-12799: Upgrade of the 3rd party dependencies to the latest stable… (#18487) * BAP-12799: Upgrade of the 3rd party dependencies to the latest stable version - updated doctrine - updated compile... — committed to oro-flex/test-utils by anyt 6 years ago
- BAP-12799: Upgrade of the 3rd party dependencies to the latest stable… (#18487) * BAP-12799: Upgrade of the 3rd party dependencies to the latest stable version - updated doctrine - updated compile... — committed to oro-flex/batch-bundle by anyt 6 years ago
In my case I just specified the
server_version
and it just worked:I soved doing like this #app\config\config.yml
@sebastianfeldmann Good job there. In other words, 99a62a7 just exposed the issue which was just hiding there previously… And now this is marked as an expected BC break in bugfix version…
Anyway, this behavior doesn’t make any sense IMHO. I’m explicitly registering only one connection and default_connection points to this specific connection, so why is the bundle even trying to create a connection that was not requested or even used anywhere? (Also driver defaulting to pdo_mysql is just another crazy assumption, but that’s different story.) 😕
So what should I change to fix this then?
I’m using debian, just run mysql -V
My solution was to just start my database server. -___- Really confusing error message for such a simple problem.
Hello i have the same issue it seems that i need to specify my doctrine dbal server_version, but i can’t find where, here is a tree of my project…:
. ├── app │ ├── AppCache.php │ ├── AppKernel.php │ ├── AppKernel.php~ │ ├── config │ │ ├── config_dev.yml │ │ ├── config_dev.yml~ │ │ ├── config_prod.yml │ │ ├── config.yml │ │ ├── override │ │ │ ├── config.yml │ │ │ ├── routing.yml │ │ │ ├── Services │ │ │ │ ├── entities_manager.yml │ │ │ │ └── forms.yml │ │ │ └── services.yml │ │ ├── parameters.yml │ │ ├── parameters.yml~ │ │ ├── parameters.yml.dist │ │ ├── routing.yml │ │ ├── rsync_exclude.txt │ │ ├── security.yml │ │ └── services.yml │ ├── console │ └── Resources │ └── views │ └── base.html.twig ├── auth.json ├── auth.json.dist ├── bin │ ├── behat -> …/vendor/behat/behat/bin/behat │ ├── console │ ├── cssmin -> …/vendor/tubalmartin/cssmin/cssmin │ ├── doctrine -> …/vendor/doctrine/orm/bin/doctrine │ ├── doctrine-dbal -> …/vendor/doctrine/dbal/bin/doctrine-dbal │ ├── doctrine-migrations -> …/vendor/doctrine/migrations/bin/doctrine-migrations │ ├── php-parse -> …/vendor/nikic/php-parser/bin/php-parse │ ├── phpunit -> …/vendor/phpunit/phpunit/phpunit │ ├── security-checker -> …/vendor/sensiolabs/security-checker/security-checker │ ├── selenium-head │ ├── selenium-headless │ ├── simple-phpunit -> …/vendor/symfony/phpunit-bridge/bin/simple-phpunit │ ├── symfony_requirements │ └── update-app ├── CODING_STANDARD.md ├── composer.json ├── composer.lock ├── composer.phar ├── doc ├── features ├── LICENSE ├── packages.json.dist ├── phpmd.xml
This is taking me hours…
a question i try to move symfony to heroku; in local works fine but when i deplay on heroku i found this error … what is the solution?
thanks
Hi the problem ist not with @mikeSimonson changes introduced with commit 99a62a7c4139c0ccb6969de5eff1447b1a6cbaf4
Applying the commented types even if no "un"commented types exist is a valid fix.
Analysis
After consulting wit @Ocramius the assumption is, that because now
CommentedTypes
are always registered, doctrine tries to register them on the predefined default_connection.The problem is that we are now registering types on a connection we don’t use, or in this case isn’t woking at all.
Solution
A solution would be to handle the type registration within DBAL but because of this breaking backwards compatibility the only thing we can do right now is to throw some more descriptive exception so the user understand the problem.