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. Built from https://develop.svn.wordpress.org/trunk@41820 git-svn-id: http://core.svn.wordpress.org/trunk@41654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3609d0c4c5
commit
fd247bc2e4
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.9-beta1-41819';
|
||||
$wp_version = '4.9-beta1-41820';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
|
@ -1621,9 +1621,10 @@ class wpdb {
|
|||
return false;
|
||||
}
|
||||
|
||||
$host = '';
|
||||
foreach ( array( 'host', 'port', 'socket' ) as $component ) {
|
||||
if ( array_key_exists( $component, $matches ) ) {
|
||||
$$component = $matches[$component];
|
||||
if ( ! empty( $matches[ $component ] ) ) {
|
||||
$$component = $matches[ $component ];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue