Changeset 42229 for branches/4.9
- Timestamp:
- 11/27/2017 12:55:11 AM (7 years ago)
- Location:
- branches/4.9
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
-
branches/4.9/src/wp-includes/wp-db.php
r42120 r42229 1644 1644 $is_ipv6 = false; 1645 1645 1646 // First peel off the socket parameter from the right, if it exists. 1647 $socket_pos = strpos( $host, ':/' ); 1648 if ( $socket_pos !== false ) { 1649 $socket = substr( $host, $socket_pos + 1 ); 1650 $host = substr( $host, 0, $socket_pos ); 1651 } 1652 1646 1653 // We need to check for an IPv6 address first. 1647 1654 // An IPv6 address will always contain at least two colons. 1648 1655 if ( substr_count( $host, ':' ) > 1 ) { 1649 $pattern = '#^(?:\[)?(?<host>[0-9a-fA-F:]+)(?:\]:(?<port>[\d]+))? (?:/(?<socket>.+))?#';1656 $pattern = '#^(?:\[)?(?<host>[0-9a-fA-F:]+)(?:\]:(?<port>[\d]+))?#'; 1650 1657 $is_ipv6 = true; 1651 1658 } else { 1652 1659 // We seem to be dealing with an IPv4 address. 1653 $pattern = '#^(?<host>[^:/]*)(?::(?<port>[\d]+))? (?::(?<socket>.+))?#';1660 $pattern = '#^(?<host>[^:/]*)(?::(?<port>[\d]+))?#'; 1654 1661 } 1655 1662 … … 1663 1670 1664 1671 $host = ''; 1665 foreach ( array( 'host', 'port' , 'socket') as $component ) {1672 foreach ( array( 'host', 'port' ) as $component ) { 1666 1673 if ( ! empty( $matches[ $component ] ) ) { 1667 1674 $$component = $matches[ $component ]; -
branches/4.9/tests/phpunit/tests/db.php
r42056 r42229 1560 1560 ), 1561 1561 array( 1562 ':/tmp/mysql:with_colon.sock', 1563 false, 1564 '', 1565 null, 1566 '/tmp/mysql:with_colon.sock', 1567 false, 1568 ), 1569 array( 1562 1570 '127.0.0.1', 1563 1571 false, … … 1576 1584 ), 1577 1585 array( 1586 '127.0.0.1:3306:/tmp/mysql:with_colon.sock', 1587 false, 1588 '127.0.0.1', 1589 '3306', 1590 '/tmp/mysql:with_colon.sock', 1591 false, 1592 ), 1593 array( 1578 1594 'example.com', 1579 1595 false, … … 1608 1624 ), 1609 1625 array( 1626 'localhost:/tmp/mysql:with_colon.sock', 1627 false, 1628 'localhost', 1629 null, 1630 '/tmp/mysql:with_colon.sock', 1631 false, 1632 ), 1633 array( 1610 1634 '0000:0000:0000:0000:0000:0000:0000:0001', 1611 1635 false, … … 1640 1664 ), 1641 1665 array( 1666 '[::1]:3306:/tmp/mysql:with_colon.sock', 1667 false, 1668 '::1', 1669 '3306', 1670 '/tmp/mysql:with_colon.sock', 1671 true, 1672 ), 1673 array( 1642 1674 '2001:0db8:0000:0000:0000:ff00:0042:8329', 1643 1675 false,
Note: See TracChangeset
for help on using the changeset viewer.