[php-src] Issue #13930: Database connections using PDO ODBC to Oracle fail after upgrade to 8.2

From: Date: Wed, 10 Apr 2024 04:40:00 +0000
Subject: [php-src] Issue #13930: Database connections using PDO ODBC to Oracle fail after upgrade to 8.2
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246729@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/13930 Author: stephenbeauchamp ### Description The following code works in 8.1 but not 8.2 or 8.3 ``` <?php print ('test begins' . PHP_EOL); $conn = new PDO( 'odbc:Driver=Oracle 21 ODBC driver;dbq=//10.20.30.40:1521/dbora.example.com;ServerName=//10.20.30.40/dbora.example.com;Connection Timeout=3;', 'myUser', // !!!NOTE!!! username supplied outside connection string 'P$PNmE332ygYb!43' // !!!NOTE!!! password supplied outside connection string ); $conn->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $conn->setAttribute(\PDO::ATTR_CASE, \PDO::CASE_LOWER); $stmt = $conn->prepare('select sysdate from dual'); $stmt->execute(); $res = $stmt->fetchall(PDO::FETCH_ASSOC); var_dump($res); ?> ``` returns the error ``` PHP Fatal error: Uncaught PDOException: SQLSTATE[28000] SQLDriverConnect: 1017 [Oracle][ODBC][Ora]ORA-01017: invalid username/password; logon denied ``` Moving the username and password into the connection string is a work around - this returns query results in 8.1, 8.2 and 8.3. ``` $conn = new PDO( 'odbc:Driver=Oracle 21 ODBC driver;dbq=//10.20.30.40:1521/dbora.example.com;UID=myUser;PWD=P$PNmE332ygYb!43;ServerName=//10.20.30.40/dbora.example.com;Connection Timeout=3;' ); ``` I strongly suspect it's the special characters in the password. I have tried to escape the characters using many different escape sequences without success - no escape is required with the password in the connection string. System details ``` # uname -a Linux 91c64bbe3086 5.4.0-1109-azure #115~18.04.1-Ubuntu SMP Mon May 22 20:06:37 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux # // oracle drivers /opt/oracle/instantclient_21_9/ # // unixodbc unixodbc/now 2.3.9-5 amd64 [installed,local] # // ODBC tool returns data from the command line with password as arg. isql DBORA myUser 'P$PNmE332ygYb!43' ``` ### PHP Version PHP 8.2.12, PHP 8.2.17 and PHP 8.3 ### Operating System Ubuntu 22.04

« previous php.bugs (#246729) next »