J4 Issue ?
avatar PhilETaylor
PhilETaylor
26 Apr 2017

At the moment there is no validation, if you enter an invalid mysql database name (like 'joomla-4') then the installation doesnt warn, but hangs on a later step (creating the db)

screen shot 2017-04-26 at 13 18 49

avatar PhilETaylor PhilETaylor - open - 26 Apr 2017
avatar joomla-cms-bot joomla-cms-bot - change - 26 Apr 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 26 Apr 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 26 Apr 2017
Category Installation
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 9 Jun 2017

@mbabker Issue for 4.0-Projects?

avatar franz-wohlkoenig franz-wohlkoenig - change - 9 Jun 2017
Status New Information Required
avatar franz-wohlkoenig franz-wohlkoenig - change - 19 Aug 2017
Status Information Required Discussion
avatar brianteeman brianteeman - change - 25 Mar 2018
Labels Added: J4 Issue
avatar brianteeman brianteeman - labeled - 25 Mar 2018
avatar brianteeman
brianteeman - comment - 13 Jul 2018

Bizarrely I just tested this (on windows) and successfully created a database called &(%£""%^(`;

but I agree we should be validating on entry https://stackoverflow.com/questions/9537771/mysql-database-name-restrictions

avatar brianteeman brianteeman - change - 7 Aug 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-08-07 13:28:35
Closed_By brianteeman
avatar brianteeman
brianteeman - comment - 7 Aug 2018

closed see #21447

avatar brianteeman brianteeman - close - 7 Aug 2018
avatar continga
continga - comment - 14 Sep 2018

Can we please reopen this issue @brianteeman ?

I think the current solution in Joomla 4 codebase

if (!preg_match('#^[a-zA-Z][0-9a-zA-Z_$]*$#', $options->db_name))

and
if (!preg_match('#^[a-zA-Z][0-9a-zA-Z_$]*$#', $options->db_name))

is waaaaay to strict.

E.g. in mariadb basically everything is allowed[1], so especially something like 'joomla-4', and I am using database names with dashes in them in production on all my servers for years now, without even a single problem. All applications work with this. Why should Joomla enforce something that is not needed?

So the current logic in Joomla 4 is unneeded way too strict. From my point of view, we should change that current regex to some kind of other logic. Maybe we can somehow query the DBMS and ask whether that database exists, that should be a safe way to check if it is a valid name?

Opinions?

[1] = https://mariadb.com/kb/en/library/identifier-names/

avatar bjxrn
bjxrn - comment - 6 Nov 2018

I agree that the current solution is way to strict and will prevent installation using valid database names.

The example given in the top post is wrong. joomla-4 is a valid MySQL database name as long as it is quoted. And quoting is handled by Joomla's database layer.

Edit: See the MySQL docs regarding identifiers.

avatar wilsonge wilsonge - change - 6 Nov 2018
Status Closed New
Closed_Date 2018-08-07 13:28:35
Closed_By brianteeman
avatar wilsonge wilsonge - reopen - 6 Nov 2018
avatar PhilETaylor
PhilETaylor - comment - 15 Nov 2018

Tagging #23041 for visibility. (The inability to create tables that start with an integer)

avatar Quy Quy - change - 7 Feb 2019
Status New Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-02-07 05:52:39
Closed_By Quy
avatar joomla-cms-bot joomla-cms-bot - change - 7 Feb 2019
Status Fixed in Code Base Closed
Closed_Date 2019-02-07 05:52:39 2019-02-07 05:52:40
Closed_By Quy joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 7 Feb 2019
avatar joomla-cms-bot
joomla-cms-bot - comment - 7 Feb 2019

Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/15583

avatar Quy
Quy - comment - 7 Feb 2019

Fixed with PR #23704


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15583.

Add a Comment

Login with GitHub to post a comment