Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#25228 closed defect (bug) (wontfix)

wpdb::db_version() not permissive enough

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

Description

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 11 years ago.
db_version.2.patch (456 bytes) - added by ozh 11 years ago.

Download all attachments as: .zip

Change History (9)

@ozh
11 years ago

#1 @nacin
11 years ago

This would break things like 5.5-ubuntu-4.20.

#2 @ozh
11 years ago

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

#3 @nacin
11 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
11 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( 
	'omgmysql-5.5-ubuntu-4.20',
	'mysql5.5-ubuntu-4.20',
	'5.5-ubuntu-4.20',
	'5.5-beta2',
	'5.5',
);

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.

@ozh
11 years ago

#5 @ozh
11 years ago

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

#6 @johnbillion
11 years ago

  • Milestone Awaiting Review deleted

#7 @SergeyBiryukov
11 years ago

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