Make WordPress Core

Opened 8 months ago

Closed 6 months ago

Last modified 5 months 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 8 months ago.
db_version.2.patch (456 bytes) - added by ozh 8 months ago.

Download all attachments as: .zip

Change History (9)

ozh8 months ago

comment:1 nacin8 months ago

This would break things like 5.5-ubuntu-4.20.

comment:2 ozh8 months ago

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

comment:3 nacin8 months 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?

comment:4 ozh8 months 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.

ozh8 months ago

comment:5 ozh6 months ago

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

comment:6 johnbillion6 months ago

  • Milestone Awaiting Review deleted

comment:7 SergeyBiryukov5 months ago

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