[TASK] Database creating fails due to not allowed characters
authorJigal van Hemert <jigal@xs4all.nl>
Sat, 22 Sep 2012 05:08:57 +0000 (07:08 +0200)
committerJigal van Hemert <jigal@xs4all.nl>
Sat, 22 Sep 2012 05:14:18 +0000 (07:14 +0200)
Due to compatibility the CREATE DATABASE statement is used without quotes.
At least for MySQL databases there are limited characters allowed to use
in unquoted database names (0-9,a-z,A-Z$_). At the moment the database
name is parsed with enabled hyphen but this is obviously not allowed. The
parsing has to be changed to meet the MySQL limitation as well.

Change-Id: Id8e025e6c681487818973a595652dd29cb86c4b8
Resolves: #41151
Releases: 4.5, 4.6, 4.7, 6.0
Reviewed-on: http://review.typo3.org/14898
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
typo3/sysext/install/mod/class.tx_install.php

index 91a40f5..cd6c971 100644 (file)
@@ -3670,7 +3670,7 @@ REMOTE_ADDR was '".t3lib_div::getIndpEnv('REMOTE_ADDR')."' (".t3lib_div::getIndp
                                                // New database?
                                        if (trim($this->INSTALL['localconf.php']['NEW_DATABASE_NAME'])) {
                                                $newdbname=trim($this->INSTALL['localconf.php']['NEW_DATABASE_NAME']);
-                                               if (!preg_match('/[^[:alnum:]_-]/',$newdbname)) {
+                                               if (!preg_match('/[^[:alnum:]_]/',$newdbname)) {
                                                        if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) {
                                                                if ($GLOBALS['TYPO3_DB']->admin_query('CREATE DATABASE ' . $newdbname . ' CHARACTER SET utf8')) {
                                                                        $this->INSTALL['localconf.php']['typo_db'] = $newdbname;