DBAL-49: PDOSqlsrv's constructor breaks when using non "local" server host #1691

doctrinebot opened this Issue Sep 7, 2010 · 2 comments

1 participant


Jira issue originally created by user aarondm:


Currently, the _constructPdoDsn()* for the PDOSqlsrv driver works fine only if the host provided is: local or *localhost.
If using an IP address, this breaks. Reason is because _constructPdoDsn() applies ( and ) around the host.

        $dsn = 'sqlsrv:server=(';
        if (isset($params['host'])) {
            $dsn .= $params['host'];
        $dsn .= ')';

This is fine for when $params['host'] = 'local'; because I believe local is a name pipe (I think) and to properly use it you need to add the brackets around it

However if $params['host'] = ''; this breaks!


Get rid of the forced brackets

        $dsn = 'sqlsrv:server=';
        if (isset($params['host'])) {
            $dsn .= $params['host'];

That way, when supplying local* as a host, you have to enter *(local) (which makes more sense as that's how you would do it normally in other applications).


Comment created by @beberlei:

This is fixed in master.


Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added the Bug label Dec 6, 2015
@doctrinebot doctrinebot added this to the 2.0.0-RC1-RC3 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment