Task #36419

Migrate core from mysql to mysqli

Added by Stefan Neufeind about 1 year ago. Updated 3 months ago.

Status:Resolved Start date:2012-04-22
Priority:Should have Due date:
Assignee:- % Done:

100%

Category:-
Target version:-
TYPO3 Version:6.0 Complexity:
PHP Version:
Votes: 6 (View)

Description

Without using dbal core still uses the mysql-extension instead of mysqli. But PHP officially claims mysql to be "legacy" and mysqli is shipped with PHP since quite a while now. Since PHP 5.3.0 now mysqli also supports persistent connections. So it should be "quite simple" to replace the few direct calls to mysql-functions with mysqli-equivalents. It's just a different ressource (well, an object then) that is returned, so the inner parts in TYPO3 passing around the DB-handler can (almost) stay as is.

All extensions should use TYPO3-functionality to access the database, so no change should be required on that part. It might be that some directly execute mysql_query()-calls or the like, so this is kind of a "break". But things are easy to fix - and then maybe they could switch to using the TYPO3-functions for it anyway :-)

Might this be a candidate for 6.0? Patch itself should be quite easy to do.


Related issues

related to Core - Feature #16232: support mysqli extension Resolved 2006-06-13
related to Core - Bug #46330: Install tool: PHP Runtime Deprecation Notice: mysql_list_... Resolved 2013-03-15
related to Core - Bug #46806: fetch_field_redirect returns object but not array Resolved 2013-03-30
related to Core - Bug #46805: Integrity test fails Resolved 2013-03-30
related to Core - Bug #46802: Typo3DatabaseBackend get function does not return FALSE Resolved 2013-03-30
blocks Core - Bug #46825: mysqli::real_connect() / Unknown MySQL server Closed 2013-03-31
precedes DBAL - Bug #47090: Database link is expected to be an object New 2013-04-10

Associated revisions

Revision f0d8ed91
Added by Stefan Neufeind 3 months ago

[TASK] Migrate core from mysql to mysqli

Resolves: #36419
Releases: 6.1
Change-Id: If34deb026f3118db04477d14b735d76c1606aa97
Reviewed-on: https://review.typo3.org/19280
Reviewed-by: Oliver Klee
Reviewed-by: Felix Kopp
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
Reviewed-by: Steffen Ritter
Tested-by: Philipp Gampe
Reviewed-by: Benjamin Mack
Tested-by: Benjamin Mack

Revision 3e309294
Added by Christian Kuhn 3 months ago

[BUGFIX] Integrity test fails

The integerity test checks if TYPO3_DB is a resource. After switch to
mysqli, this is now an object and thus reflected with the patch now.
At the same time, the $link property - while it changed its type - is
now made protected, and a getter / setter is added.

Change-Id: I5ecdcc27f628352a26a51fc28d5a9d7be5e16315
Resolves: #46805
Related: #36419
Releases: 6.1
Reviewed-on: https://review.typo3.org/19447
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn

Revision 4a8277fa
Added by Christian Kuhn 3 months ago

[TASK] NEWS.txt entry about mysql to mysqli switch

Change-Id: Idb67b153daea1a233e54ec164b4abdb9cbeb331c
Related: #36419
Reviewed-on: https://review.typo3.org/19443
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn

Revision b706dba4
Added by Christian Kuhn 3 months ago

[BUGFIX] fetch_field_redirect returns object but not array

Method sql_field_type was rewritten with the mysqli switch for
compatibility with the old behavior. The introduced call to
fetch_field_redirect returns an object, but the result is
handled as an array, leading to warnings.

Change-Id: I73c434e8ce8086f4e60e119f4c2e2d1e2c9c7d20
Fixes: #46806
Related: #36419
Reviewed-on: https://review.typo3.org/19448
Reviewed-by: Philipp Gampe
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Tested-by: Philipp Gampe
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn

History

Updated by Philipp Gampe about 1 year ago

+1 If the API does not change and dbal works too, I see no reason not to move to modern technologies :P

Updated by Philipp Gampe about 1 year ago

Warming this up, do you want to push a patch?

Updated by Felix Kopp 10 months ago

Am I correct that only the typo3_db sql functions must be changed +dbal?

Updated by Stefan Neufeind 10 months ago

Last time I gave it a short look imho not too many things need updating. Imho we might think whether it makes sense in this step to also change the variable for accessing the database to be an array (to possibly hold multiple connections, which could be a pool to be used by extensions or so).

Updated by Markus Klein 3 months ago

Since PHP 5.4 is out mysql is deprecated now. I guess it's a good time now to integrate mysgli in TYPO3 CMS 6.1.
PDO is also an option, but I don't have experience with it.

Updated by Gerrit Code Review 3 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19280

Updated by Gerrit Code Review 3 months ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19280

Updated by Gerrit Code Review 3 months ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19280

Updated by Gerrit Code Review 3 months ago

Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19280

Updated by Stefan Neufeind 3 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF