#65529handler_init - wrong management of port if null
Description
On \TYPO3\CMS\Dbal\Database\DatabaseConnection, method handler_init
If $handlerKey === ‘_DEFAULT’, the current port (this->handlerCfg[$handlerKey][‘config’][‘port’) is set to (int)$this->databasePort.
If $this->databasePort is 0, 0.1, it’s ok. However, if it’s null, it returns 0;
By this way, when using for mssqlnative,
$cfgArray[‘config’][‘host’] . (isset($cfgArray[‘config’][‘port’]) ? ‘:’ . $cfgArray[‘config’][‘port’] : ‘’) (Line 3102)
always renders, for example :
8.8.8.8:0
It causing an error.
To avoid this, I suggest :
if(isset($this->databasePort)) {
$this->handlerCfg[$handlerKey]['config']['port'] = (int)$this->databasePort;
}
instead of
$this->handlerCfg[$handlerKey]['config']['port'] = (int)$this->databasePort; (line 3020)
By this way, if it’s null, it won’t render “:0”.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.