Repro case:
- Install Drupal 8 in English (Either via a Web browser or Drush)
- Enter a database name drupal8-qa-test
- Install crashes.
- settings.php has a value of 'database' => "drupal8-qa-test"
- Drupal is looking for "drupal8qatest"
- Database has been created with name drupal8qatest
Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\InvalidArgumentException' with message 'The service definition "renderer" does not exist.' in drupal8-qa-test\core\vendor\symfony\dependency-injection\ContainerBuilder.php:868 Stack trace: #0 drupal8-qa-test\core\vendor\symfony\dependency-injection\ContainerBuilder.php(478): Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition('renderer') #1 drupal8-qa-test\core\lib\Drupal.php(157): Symfony\Component\DependencyInjection\ContainerBuilder->get('renderer') #2 drupal8-qa-test\core\includes\install.core.inc(1152): Drupal::service('renderer') #3 drupal8-qa-test\core\includes\install.core.inc(1090): install_database_errors(Array, './sites/default...') #4 drupal8-qa-test\core\includes\install.core.inc(369): install_verify_database_settings('sites/default') #5 drupal8-qa-test\core\includes\install.core.i in drupal8-qa-test\core\vendor\symfony\dependency-injection\ContainerBuilder.php on line 868
Comments
Comment #2
JulienD commentedHi,
The database name is sanitized in the createDatabase() function (in core/lib/Drupal/Core/Database/Driver/mysql/Connection.php) by the use of :
This function forces all database names to be strictly alphanumeric-plus-underscore. I'm sure there are great motivations for that (be generic for all the DB drivers?) but this means we need to do the same operation on the database name stored in the settings.php
Comment #3
hass commentedWhy are you removing the issue summary?
Comment #4
hass commentedComment #5
hass commentedComment #6
hass commentedIs
$database = Database::getConnection()->escapeDatabase($database);not called at install form submit? Saving invalid names in settings.php sound wrong to me.Comment #7
JulienD commented@hass, sorry for the summary, it was a mistake.
I don't either like the idea of saving modified names, but does it make sens to have a db name in Mysql called "drupal8qatest" and "drupal8-qa-test" in settings.php ?
An other solution could be to modify values when loading info from settings.php. This needs to be catched in order to avoid doing the regex all the time, but I'm not fan of that too.
Maybe the easiest solution is to simply create a form validate on the DB name field to inform users they can't use hyphens in DB names ?
Comment #8
hass commentedIf the database name is drupal8qatest it should be the same in settings.php. We could also implement the form validation.
Comment #9
perignon commentedSitting here at Drupalcon and this is still an issue. Just FYI. Dashes in the DB name crash D8. I installed from Drush with no problem but loading the site is a WSOD.
Comment #10
JulienD commentedRegarding MySQL documentation dash are allowed but database names need to be wrapped in-between quotes. By default, MySQL allow underscore
Basically:
There are several problems we need to solve:
1) We need to describe on the Database Name field that not all characters are allowed (names must be strictly alphanumeric-plus-underscore).
2) Add a field validate to avoid the form be submitted.
3) Updating the function that write db settings to settings.php to use the DB clean up database name.
Notes :
- The form construction is done by getFormOptions() in core/lib/Drupal/Core/Database/Install/Tasks.php
- The escape database function escapeDatabase() is located in core/lib/Drupal/Core/Database/Connection.php
Comment #11
perignon commentedShould the title be updated to reflect the real underlying issue?
Comment #12
JulienD commentedClosing the issue because an older one is already existing #2443839
I have summarized patches and conversations over there