HyperDB icon indicating copy to clipboard operation
HyperDB copied to clipboard

Undefined variable: host

Open cfinke opened this issue 3 years ago • 0 comments

In db_connect(), if the condition while ( ( $group_key = array_shift( $this->unused_servers[ $dbhname ] ) ) ) { is never met, $host and $port will be undefined when the $error_details array is created, generating a PHP notice.

It could be fixed by just adding:

if ( ! isset( $host ) ) { $host = ''; }
if ( ! isset( $port ) ) { $port = ''; }

before $error_details, but I don't know if that would be masking the root issue (should the while loop always execute at least once?) or not.

cfinke avatar Apr 19 '22 18:04 cfinke