Make WordPress Core

Changeset 42549


Ignore:
Timestamp:
01/23/2018 03:38:42 AM (7 years ago)
Author:
dd32
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/wp-db.php

    r42388 r42549  
    17041704        // An IPv6 address will always contain at least two colons.
    17051705        if ( substr_count( $host, ':' ) > 1 ) {
    1706             $pattern = '#^(?:\[)?(?<host>[0-9a-fA-F:]+)(?:\]:(?<port>[\d]+))?#';
     1706            $pattern = '#^(?:\[)?(?P<host>[0-9a-fA-F:]+)(?:\]:(?P<port>[\d]+))?#';
    17071707            $is_ipv6 = true;
    17081708        } else {
    17091709            // We seem to be dealing with an IPv4 address.
    1710             $pattern = '#^(?<host>[^:/]*)(?::(?<port>[\d]+))?#';
     1710            $pattern = '#^(?P<host>[^:/]*)(?::(?P<port>[\d]+))?#';
    17111711        }
    17121712
Note: See TracChangeset for help on using the changeset viewer.