?
avatar nikosdion
nikosdion
18 Nov 2017

Steps to reproduce the issue

Look at the configuration.php-dist

Expected result

The driver name mysqli with the trailing i is accurate.

Actual result

If you try to use that you get a crash. The MySQLi driver name in Joomla! 4 is mysql, not mysqli.

System information (as much as possible)

Irrelevant.

Additional comments

IMHO this is a bad choice for naming the driver.

Problem for users: they have heard us tell them for years that MySQL is deprecated and they should be using MySQLi. The literature (documentation, forum posts, blog posts) out there says you should use MySQLi. There is a discrepancy between what the PHP information reports (MySQLi with the trailing i) and what Joomla! expects in configuration.php.

Problem for developers: Granted, not many of us are affected. Probably just me and the Falang guys. When I'm restoring your backups I don't know which Joomla! version you are using with absolute certainty. I check which PHP extensions are available and give you the relevant options. Now I have to somehow magically figure out when you are using Joomla! 4 and map MySQLi to MySQL which I can guarantee will be a source of bugs.

I would keep the driver consistently named mysqli with the trailing i to save everyone's sanity. Knowing that this is Joomla!, where sanity comes to die, I am preparing to add yet another layer of compatibility in my software and God help me :)

avatar nikosdion nikosdion - open - 18 Nov 2017
avatar joomla-cms-bot joomla-cms-bot - change - 18 Nov 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 18 Nov 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 18 Nov 2017
Category com_installer
avatar joomla-cms-bot joomla-cms-bot - edited - 18 Nov 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 18 Nov 2017
Title
Joomla! 4: the driver name is misleading
[4.0] The driver name is misleading
avatar mbabker
mbabker - comment - 18 Nov 2017

MySQLi is still MySQLi. Because of how things got named with the Framework and it dropping ext/mysql support when that was built up what is actually happening is "pdomysql" in 3.x is now "mysql". It'd take some creative editing but we might be able to get the old name/type back there.

avatar franz-wohlkoenig franz-wohlkoenig - change - 18 Nov 2017
Status New Discussion
avatar nikosdion
nikosdion - comment - 18 Nov 2017

That's confusing. When I tried using mysqli I got an error on Joomla! 4: Uncaught RuntimeException: The MySQLi extension is not available in /.../libraries/vendor/joomla/database/src/Mysqli/MysqliDriver.php

However, that's most definitely a blatant lie. I am using MySQLi with Joomla! 3.

On the other hand if I use pdomysql it works fine. Same goes for mysql.

So, to sum it up:

  • Joomla! mistakenly things I don't have MySQLi installed when I do.
  • Using pdomysql works which is confusing since, as you said, it should be called mysql now.

Um, did I break everything as soon as I touched it? :D

avatar mbabker
mbabker - comment - 18 Nov 2017

In the service provider we mapped "pdomysql" to "mysql" so sites didn't crash and burn on updating. So that's why using that can still work.

https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/vendor/joomla/database/src/Mysqli/MysqliDriver.php#L350 is the support check for MySQLi. The part that might be tripping you up is the presence of mysqli_stmt_get_result and that's the whole mysqlnd thing.

avatar brianteeman
brianteeman - comment - 18 Nov 2017

/me confused

avatar nikosdion
nikosdion - comment - 18 Nov 2017

OK, now it makes perfect sense!

After RTFMing a little bit it seems that prepared statements are only available with the mysqlnd driver. This is, in fact, not available on my system. Humph. I'll have to check the build options.

Now, Joomla! 4 looks for prepared statement support. Since it's missing (per the explanation above) it believes that the MySQLi driver is missing. This explains why I couldn't see it in the installer or use it.

The mapping of pdomysql to mysql makes perfect sense now, thank you. And since PDO always supports prepared statements we can use it just fine.

I think you need to document that mysqlnd is required and warn people in the installer if MySQLi is available but it doesn't use mysqlnd. This would at least point users to the right direction for solving installation issues. Not to mention that this has to be a pre-upgrade check.

I am closing this issue as I consider it resolved for the scope that I submitted it.

avatar nikosdion nikosdion - change - 18 Nov 2017
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2017-11-18 14:34:31
Closed_By nikosdion
avatar nikosdion nikosdion - close - 18 Nov 2017

Add a Comment

Login with GitHub to post a comment