mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 04:40:26 +00:00
Database: When parsing the host, leave the port and socket as null if they're not defined.
This fixes a change in behaviour introduced by [41629]. The host is set to an empty string when it isn't defined, this continues existing behaviour. In particular, the mysqli library treats a `null` host as being the same as `localhost`, which is not always the intended behaviour. Props birgire, markjaquith, pento. Fixes #41722. git-svn-id: https://develop.svn.wordpress.org/trunk@41820 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1208,10 +1208,10 @@ class Tests_DB extends WP_UnitTestCase {
|
||||
|
||||
list( $parsed_host, $parsed_port, $parsed_socket, $parsed_is_ipv6 ) = $data;
|
||||
|
||||
$this->assertEquals( $host, $parsed_host );
|
||||
$this->assertEquals( $port, $parsed_port );
|
||||
$this->assertEquals( $socket, $parsed_socket );
|
||||
$this->assertEquals( $is_ipv6, $parsed_is_ipv6 );
|
||||
$this->assertSame( $host, $parsed_host );
|
||||
$this->assertSame( $port, $parsed_port );
|
||||
$this->assertSame( $socket, $parsed_socket );
|
||||
$this->assertSame( $is_ipv6, $parsed_is_ipv6 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1220,7 +1220,7 @@ class Tests_DB extends WP_UnitTestCase {
|
||||
array(
|
||||
'', // DB_HOST
|
||||
false, // Expect parse_db_host to bail for this hostname
|
||||
null, // Parsed host
|
||||
'', // Parsed host
|
||||
null, // Parsed port
|
||||
null, // Parsed socket
|
||||
false, // is_ipv6
|
||||
@@ -1228,7 +1228,7 @@ class Tests_DB extends WP_UnitTestCase {
|
||||
array(
|
||||
':3306',
|
||||
false,
|
||||
null,
|
||||
'',
|
||||
'3306',
|
||||
null,
|
||||
false,
|
||||
@@ -1236,7 +1236,7 @@ class Tests_DB extends WP_UnitTestCase {
|
||||
array(
|
||||
':/tmp/mysql.sock',
|
||||
false,
|
||||
null,
|
||||
'',
|
||||
null,
|
||||
'/tmp/mysql.sock',
|
||||
false,
|
||||
|
||||
Reference in New Issue
Block a user