propelorm / Propel2

Propel2 is an open-source high-performance Object-Relational Mapping (ORM) for modern PHP
http://propelorm.org/
MIT License
1.26k stars 396 forks source link

SQLSTATE[IMSSP]: An invalid keyword 'user' was specified in the DSN string Propel2-Beta4 #2013

Open GeorgeOnyango opened 1 month ago

GeorgeOnyango commented 1 month ago

propel init create a wrong DSN when pdo_sqlsrv driver is selected. I observed line 389 in the InitCommand.php literally inserts user and password into the DSN as shown in the code snippet below. This in turn results to SQLSTATE[IMSSP] error being thrown later when the DSN is used in the PdoConnection.php to establish a connection to MSSQL server.

$fullDsn = sprintf('%s;user=%s;password=%s', $options['dsn'], urlencode($options['user']), urlencode($options['password']));

Changing the line to the snippet below fixes the problem but I suppose this might in turn result to an error for the other drivers that requires/supports user and password in the DSN string.

$fullDsn = $options['dsn'];