Steps to reproduce:

  • Create a new instance without a database already created.
  • Start a new instance, using a name of the database with a '-'.
  • Database is created, dropping the '-'; ie: d8-2 becomes d82.
  • The full database does not create.

Creates 25 tables:

show tables;
+------------------+
| Tables_in_d82 |
+------------------+
| batch |
| cache |
| cache_bootstrap |
| cache_config |
| cache_form |
| cache_menu |
| cache_page |
| cache_path |
| cache_tags |
| config_snapshot |
| flood |
| key_value |
| key_value_expire |
| menu_router |
| queue |
| role_permission |
| router |
| semaphore |
| sequences |
| sessions |
| url_alias |
| users |
| users_data |
| users_roles |
| variable |
+------------------+
25 rows in set (0.00 sec)

Error received: Fatal error: Class 'Drupal\Core\Database\DatabaseNotFoundException' not found in /my_site/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php on line 142

Call Stack
#TimeMemoryFunctionLocation10.0001643280{main}( )../install.php:020.00221387824install_drupal( )../install.php:3630.00221392912install_begin_request( )../install.core.inc:8440.02166892216install_verify_database_settings( )../install.core.inc:30250.02166892312install_database_errors( )../install.core.inc:94460.02407447304db_run_tasks( )../install.core.inc:107770.02407447864Drupal\Core\Database\Install\Tasks->runTasks( )../install.inc:94980.02407447864Drupal\Core\Database\Driver\mysql\Install\Tasks->connect( )../Tasks.php:12990.02647920008Drupal\Core\Database\Driver\mysql\Connection->createDatabase( )../Tasks.php:68

Need to check for "legal characters" in database name string.

CommentFileSizeAuthor
#4 drupal-1924278-3.patch554 bytesdawehner
#3 1924278_3.patch530 byteschx
#1 check-db-name.patch4.84 KBmarcingy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

marcingy’s picture

Status: Active » Needs review
FileSize
4.84 KB

Initial stab at patch.

chx’s picture

Status: Needs review » Needs work

The reason for this fatal is that there is no DatabaseNotFoundException class in core. At all. We use it, we throw it, we try to catch it but it doesn't exist.

chx’s picture

Status: Needs work » Needs review
FileSize
530 bytes
dawehner’s picture

FileSize
554 bytes

Copied the exception, which was forgot to introduce in the other issue: #203955: Create database at installation time

Status: Needs review » Needs work

The last submitted patch, drupal-1924278-3.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review

#4: drupal-1924278-3.patch queued for re-testing.

chx’s picture

Mine is better cos it does not do use RuntimeException -- didnt we agree on not useing root classes?

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Yeah right, well it still a bit odd.

RTBC patch from #3, sorry for the cross-patch.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Oops. :) Good catch!

Committed and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.