[wp-trac] [WordPress Trac] #25228: wpdb::db_version() not permissive enough
WordPress Trac
noreply at wordpress.org
Wed Sep 4 21:51:00 UTC 2013
#25228: wpdb::db_version() not permissive enough
-----------------------------+------------------------------
Reporter: ozh | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Upgrade/Install | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch |
-----------------------------+------------------------------
Comment (by ozh):
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.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/25228#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list