Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to mysqli driver if mysql selected in PHP 7 #6442

Merged
merged 1 commit into from May 11, 2015
Merged

Switch to mysqli driver if mysql selected in PHP 7 #6442

merged 1 commit into from May 11, 2015

Conversation

mbabker
Copy link
Contributor

@mbabker mbabker commented Mar 15, 2015

This updates JDatabaseDriver::getInstance() to detect if the requested driver is mysql which uses the removed ext/mysql PHP extension in PHP 7 and changes the driver option to mysqli in this environment. A message is logged to the deprecation logger so that a site admin can pick up on the error without disclosing any info to end users.

Note that this is not a guaranteed failsafe; if for whatever reason an environment doesn't have the ext/mysqli PHP extension this will fail.

@zero-24
Copy link
Member

zero-24 commented Mar 15, 2015

@mbabker

Note that this is not a guaranteed failsafe; if for whatever reason an environment doesn't have the ext/mysqli PHP extension this will fail.

Can we not check if mysqli or pdosql is supported and switch to it if it is supported?

@zero-24
Copy link
Member

zero-24 commented Mar 15, 2015

maybe we can place now or with 3.4.2 a postinstall message that show all admins that use mysql driver that this gets unsupported with PHP7?


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

@mbabker
Copy link
Contributor Author

mbabker commented Mar 15, 2015

I wouldn't go the post-install route right now. It's still far too early (PHP 7 isn't even in alpha phase yet) and as the forums have shown with this last release, users get in a panic and don't understand what to do when we suggested they update .htaccess or robots.txt.

I've retooled it to try and check support for the other drivers and switch to them. If no other driver is supported, it will just fail; otherwise it'll prefer MySQLi over PDO MySQL.

@zero-24
Copy link
Member

zero-24 commented Mar 15, 2015

Looks good 👍 I will try to test if i get some time.

@wilsonge
Copy link
Contributor

Would it be better for long term to try and upgrade users to PDO rather than mysqli?

@mbabker
Copy link
Contributor Author

mbabker commented Mar 16, 2015

PDO isn't installed as commonly as the mysqli extension.

@mbabker
Copy link
Contributor Author

mbabker commented May 10, 2015

This and #6433 really just need top level decisions at this point then merging into a branch. It's much easier to keep working on PHP 7 compatibility issues if PRs are merged somewhere...

wilsonge added a commit that referenced this pull request May 11, 2015
Switch to mysqli driver if mysql selected in PHP 7
@wilsonge wilsonge merged commit 9fecfa2 into joomla:staging May 11, 2015
@wilsonge wilsonge added this to the Joomla! 3.4.2 milestone May 11, 2015
@mbabker mbabker deleted the PHP7DriverGetInstance branch May 11, 2015 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants