Skip to content

Commit

Permalink
[5.3] Added check for empty port to prevent Invalid Handler Error (#1…
Browse files Browse the repository at this point in the history
…6824)

* Added check for empty port.

Prevents DSN from generating with an extra comma and throwing an Invalid Handler Error when port is specified in the database configuration but not set to a value.

Produces 'sqlsrv:Server=localhost;Database=mydb;' instead of 'sqlsrv:Server=localhost,;Database=mydb;'

* Fixed style guide
  • Loading branch information
kharysharpe authored and taylorotwell committed Dec 16, 2016
1 parent f5c8c1b commit ad52170
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Connectors/SqlServerConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ protected function buildConnectString($driver, array $arguments)
*/
protected function buildHostString(array $config, $separator)
{
if (isset($config['port'])) {
if (isset($config['port']) && ! empty($config['port'])) {
return $config['host'].$separator.$config['port'];
} else {
return $config['host'];
Expand Down

0 comments on commit ad52170

Please sign in to comment.