PDO/dblib not working anymore ("use dbName" not sent)
| Bug #65219 | PDO/dblib not working anymore ("use dbName" not sent) | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2013-07-08 13:37 UTC | Modified: | 2013-07-12 23:29 UTC |
|
||||||||||
| From: | f dot marquis at of2m dot fr | Assigned: | ssufficool (profile) | |||||||||||
| Status: | Closed | Package: | PDO related | |||||||||||
| PHP Version: | 5.4.17 | OS: | CentOS 6.4 | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2013-07-08 13:37 UTC] f dot marquis at of2m dot fr
Description: ------------ All queries to our MSSQL 2008 database (PDO_dblib with freeTDS) are failing since PHP 5.4.17 (same code) setting freeTDS into debug mode seems to indicate that the SQL queries are not sent to the correct database, but to 'master' database, so queried object are not found. FreeTDS log with PHP 5.4.17 : ... (dblib.c:239):dblib_add_connection(0x7f001af738e0, 0x7f002be94540) (dblib.c:4317):dbsetopt(0x7f002be93a00, 7, 2147483647, -1) (dblib.c:4432):UNIMPLEMENTED dbsetopt(option = 7) (dblib.c:4317):dbsetopt(0x7f002be93a00, 17, 2147483647, -1) (dblib.c:4432):UNIMPLEMENTED dbsetopt(option = 17) (dblib.c:4317):dbsetopt(0x7f002be93a00, 35, 1, -1) (dblib.c:761):dbsetlname(0x7f002be93850, Emploi, 14) (dblib.c:5762):dbsetuserdata(0x7f002be93a00, 0x7f002a851fa0) (dblib.c:3196):dbcancel(0x7f002be93a00) (query.c:2155):tds_send_cancel: not in_cancel and idle (dblib.c:1312):dbcmd(0x7f002be93a00, SELECT col FROM table WHERE id = 1 ) ... FreeTDS log with PHP 5.4.11 (working) : ... (dblib.c:239):dblib_add_connection(0x7fbc5d3d68e0, 0x7fbc6ec007f0) (dblib.c:4317):dbsetopt(0x7fbc6ebffe30, 7, 2147483647, -1) (dblib.c:4432):UNIMPLEMENTED dbsetopt(option = 7) (dblib.c:4317):dbsetopt(0x7fbc6ebffe30, 17, 2147483647, -1) (dblib.c:4432):UNIMPLEMENTED dbsetopt(option = 17) (dblib.c:4317):dbsetopt(0x7fbc6ebffe30, 35, (null), -1) (dblib.c:7929):dbperror(0x7fbc6ebffe30, 20176, 0) (dblib.c:7981):20176: "Called dbsetopt with parameter 3 NULL" (dblib.c:5780):dbgetuserdata(0x7fbc6ebffe30) (dblib.c:8002):"Called dbsetopt with parameter 3 NULL", client returns 2 (INT_CANCEL) (dblib.c:1398):dbuse(0x7fbc6ebffe30, Emploi) (dblib.c:1312):dbcmd(0x7fbc6ebffe30, use [Emploi]) (dblib.c:1319):dbcmd() bufsz = 0 (dblib.c:1369):dbsqlexec(0x7fbc6ebffe30) (dblib.c:6862):dbsqlsend(0x7fbc6ebffe30) (mem.c:615):tds_free_all_results() (util.c:156):Changed query state from IDLE to QUERYING (write.c:140):tds_put_string converting 12 bytes of "use [Emploi]" (write.c:168):tds_put_string wrote 24 bytes (util.c:156):Changed query state from QUERYING to PENDING (net.c:741):Sending packet ... You can see that the "use [dbName]" is not sent with the same way. The query is executed in "master" context, and that's why it's failing. regression from https://bugs.php.net/bug.php?id=64338 "pdo_dblib can't connect to Azure SQL" Test script: --------------- $pdo = new \PDO('dblib:host=hostname;dbname=dbname', 'username', 'password'); $stmt = $pdo->query('SELECT col FROM table WHERE id = 1'); var_dump($stmt); Expected result: ---------------- PDOStatement with the matching line from existing table Actual result: -------------- false, with this error : General SQL Server error: Check messages from the SQL Server [208] (severity 16) => Invalid object name
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2013-07-12 23:29 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: ssufficool
[2013-10-04 20:55 UTC] steven dot levin at sdepot dot com