Mihai Olteanu

7.7 mysql connection port problem

Discussion created by Mihai Olteanu on May 3, 2016
Latest reply on Oct 17, 2016 by Max Blackmer

Hello,

 

Found a bug in version 7.7 when trying to connect to a MySql server that has the port number in the hostname. The bug is in include/database/MysqliManager.php in the setupConnectOptions function at line 390:

 

//Example: 127.0.0.1:3307

$this->connectOptions['db_host_name'] = substr($this->connectOptions['db_host_name'],0,$pos); //This line changes the 'db_host_name' value, so the port will always be false

$this->connectOptions['db_port'] = substr($this->connectOptions['db_host_name'],$pos+1);

 

// Correct version:

$dbHostName = $this->connectOptions['db_host_name'];

$this->connectOptions['db_host_name'] = substr($this->connectOptions['db_host_name'],0,$pos);

$this->connectOptions['db_port'] = substr($dbHostName,$pos+1);

Outcomes