?
avatar toivo
toivo
9 Jun 2020

Steps to reproduce the issue

Install Joomla 3.9 or 4.0-beta on localhost system where MariaDB is the default DBMS but use MySQL, which has been assigned port 3308.

Expected result

localhost:3308 should be accepted as a local database server

Actual result

Warning
You are trying to use a database host which is not on your local server. For security reasons, you need to verify the ownership of your web hosting account. Please read the documentation for more information.

Error
To confirm that you are the owner of this website please delete the file named "_JoomlaNkFQ7jQhIjmbUIXD3h1SL.txt" we have created in the "installation" folder of your Joomla site.

System information (as much as possible)

3.9.20-dev Nightly Build of 9 June
4.0.0-beta2-dev Nightly Build of 9 June ‎4.0.0-beta2-dev

Wampserver 3.2.2 MySQL 8.0.19 MariaDB 10.4.10 PHP 7.4.5

Additional comments

The warning and error are not necessary in localhost environment. Those messages can confuse new users:
screen shot 2020-06-09 at 06 11 42

avatar toivo toivo - open - 9 Jun 2020
avatar joomla-cms-bot joomla-cms-bot - labeled - 9 Jun 2020
avatar richard67
richard67 - comment - 9 Jun 2020

@zero-24 Our localhost check only checks if in the list "localhost", "127.0.0.1", "::1", it doesn't check for such stuff with ports. I could change the check to use a regex, something like
^(localhost|127\.0\.0\.1|\:\:1)(\:[0-9]+)?$,
and allow optional colon with a number behind it. Could be done in J3 and J4. Shall I do that? Beginning on Thursday I would have time for that. I ping you for your opinion because as I remember, that localhost check came from you once. If you say "won't fix" I'll keep my hands in my pockets.

avatar zero-24
zero-24 - comment - 9 Jun 2020

Go for it @richard67

avatar richard67
richard67 - comment - 9 Jun 2020

Will do later today or tomorrow or so.

avatar richard67
richard67 - comment - 9 Jun 2020

I just see my regex is not ok for IPv6 with ports, because it needs square brackets around the address part when having a port but no square brackets without a port, as far as I know up to now. I'll have to tune that a bit.

avatar richard67
richard67 - comment - 9 Jun 2020

I just see it is not that easy. Unlike a web browser, where the port is a part of the URL, it works differently with the database clients, see e.g here for MySQLi: https://www.php.net/manual/de/mysqli.construct.php.

I.e. host and port are different parameters, and I have to check if our database drivers support ports. If not, there might be more to do.

avatar richard67
richard67 - comment - 10 Jun 2020

Closing as having Pull Requests.

Please test #29567 for Joomla 3.9 (staging) and #29568 for Joomla 4.

avatar richard67 richard67 - change - 10 Jun 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-06-10 17:35:15
Closed_By richard67
avatar richard67 richard67 - close - 10 Jun 2020

Add a Comment

Login with GitHub to post a comment