Bug #65529

handler_init - wrong management of port if null

Added by Guy Couronné over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2015-03-04
Due date:
% Done:

0%

TYPO3 Version:
6.2
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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".

History

#1 Updated by Xavier Perseguers over 4 years ago

  • Status changed from New to Needs Feedback

The port handling has been adapted today for both master and 6.2 with #66830 and #63070. As you are using 6.2, please update to HEAD or apply patch from http://review.typo3.org/39335 and report if fixed. Thanks.

#2 Updated by Guy Couronné over 4 years ago

Thank you.

This issue could be closed.

#3 Updated by Wouter Wolters over 4 years ago

  • Status changed from Needs Feedback to Closed

Closed as requested by the author

Also available in: Atom PDF