Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#25228 closed defect (bug) (wontfix)

wpdb::db_version() not permissive enough

Reported by: ozh Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.6
Component: Upgrade/Install Keywords: has-patch
Focuses: Cc:


I ran into a MySQL server which was returning a unusual "mysql-5.5" as a version number.

Current wpdb::db_version() returns "" (empty string) with this version number

Patch returns the expected "5.5" and works the same with traditional version numbers

Attachments (2)

db_version.patch (443 bytes) - added by ozh 2 years ago.
db_version.2.patch (456 bytes) - added by ozh 2 years ago.

Download all attachments as: .zip

Change History (9)

2 years ago

#1 @nacin
2 years ago

This would break things like 5.5-ubuntu-4.20.

#2 @ozh
2 years ago

Indeed, would return 5.54.20. Would 5.5--4.20 be acceptable?

#3 @nacin
2 years ago

I think 5.5 would be preferred, and it's why the regex does what it does.

We could strip of mysql- from the start of a string, but I'd want to A) question what server would ever do this, B) wonder what else we'd need to strip off, and C) wonder if this is worth accounting for?

#4 @ozh
2 years ago

The server I ran into was using http://www.continuent.com/ and, words from user, "they use a lot of non-standard settings".

I don't think the idea would be just to check for "mysql-" at the start, but rather for anything that's not a number. Regex '/(^[^0-9]*)|[^0-9.].*/' does the job I think

$vers = array( 

foreach( $vers as $ver ) {
	var_dump( preg_replace( '/(^[^0-9]*)|[^0-9.].*/', '', $ver ) );
string '5.5' (length=3)
string '5.5' (length=3)
string '5.5' (length=3)
string '5.5' (length=3)
string '5.5' (length=3)

Now, as for C), I'll let you judge :)

Obviously this is dealing with marginal edge case, I would tend to think we can fix marginal stuff as long as it doesn't hurt, but you be the boss, boss.

2 years ago

#5 @ozh
2 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

#6 @johnbillion
2 years ago

  • Milestone Awaiting Review deleted

#7 @SergeyBiryukov
2 years ago

  • Version changed from trunk to 3.6
Note: See TracTickets for help on using tickets.