WPDB: Use a PCRE syntax which supports PCRE compiled between 2003 and 2006.

This fixes a PHP Warning in `wpdb::parse_db_host()` when WordPress is used with (sometimes a modern) PHP that's compiled against an ancient PCRE version.

Fixes #43109 for trunk.

Built from https://develop.svn.wordpress.org/trunk@42549


git-svn-id: http://core.svn.wordpress.org/trunk@42378 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2018-01-23 03:39:30 +00:00
parent 9efeb545c0
commit fc42c062f1
2 changed files with 3 additions and 3 deletions

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-alpha-42547';
$wp_version = '5.0-alpha-42549';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -1703,11 +1703,11 @@ class wpdb {
// We need to check for an IPv6 address first.
// An IPv6 address will always contain at least two colons.
if ( substr_count( $host, ':' ) > 1 ) {
$pattern = '#^(?:\[)?(?<host>[0-9a-fA-F:]+)(?:\]:(?<port>[\d]+))?#';
$pattern = '#^(?:\[)?(?P<host>[0-9a-fA-F:]+)(?:\]:(?P<port>[\d]+))?#';
$is_ipv6 = true;
} else {
// We seem to be dealing with an IPv4 address.
$pattern = '#^(?<host>[^:/]*)(?::(?<port>[\d]+))?#';
$pattern = '#^(?P<host>[^:/]*)(?::(?P<port>[\d]+))?#';
}
$matches = array();