Edit report at https://bugs.php.net/bug.php?id=63638&edit=1
ID: 63638 Comment by: ssuffic...@php.net Reported by: pmeunier at cybergeneration dot com Summary: Cannot connect to SQL Server 2008 with PDO dblib Status: Open Type: Bug Package: PDO related Operating System: Linux Slackware 13 PHP Version: 5.4.9 Block user comment: N Private report: N New Comment: Looks like a Microsoft DBLIB versus FreeTDS issue. MS DBLIB requires the parameter to be NULL (per MSDN, possibly incorrect docs) while FreeTDS does not like the NULL parameter, thus I guess why I used "1" originally. The patch from 1 to NULL should be reverted. Previous Comments: ------------------------------------------------------------------------ [2012-12-07 16:37:58] wdmeldon at gmail dot com I've tested this in SQL Server 2012, 2008 and 2005 with similar results. The warnings do not always manifest however. I've noticed returning output will prevent the warning as will calling other functions, but it's a crap shoot. The connection seems to be fine and the data returned is as well, so more annoying than anything else. Running Ubuntu Server 12.04 with PHP 5.4.9. ------------------------------------------------------------------------ [2012-12-05 16:49:09] f dot marquis at of2m dot fr same problem here, but only from time to time (not all connections are failing like with pmeunier) seems related to #63258 ------------------------------------------------------------------------ [2012-11-28 21:43:00] pmeunier at cybergeneration dot com We made a compare between the /ext/pdo_dblib/ php 5.4.7 and php 5.4.9 and found only one file was changed. Line 318 in dblib_driver.c went from : // In PHP 5.4.7 DBSETOPT(H->link, DBQUOTEDIDENT, 1); To : // In PHP 5.4.9 DBSETOPT(H->link, DBQUOTEDIDENT, NULL); For fun, we tried to revert to passing 1 for the last parameter... and guess what ? It worked. Since we don't actually understand what this function makes, and why the parameter was changed, we don't find this solution very clean, unless it is eventually confirmed by a PHP developper. ------------------------------------------------------------------------ [2012-11-28 21:09:02] pmeunier at cybergeneration dot com Description: ------------ We are relying on PDO_DBLIB to connect to our SQL Server 2008 Server in PHP, hosted on a Linux platform. We were running PHP 5.4.7 and everything was fine. When we upgraded to 5.4.9, all connections to SQL Server were failing with the following error : Warning: PDO::__construct(): Called dbsetopt with parameter 3 NULL (severity 11). We tried with different logins to be sure that it was not a permission issue, but the bug also occurs when trying to log with 'sa'. Test script: --------------- $connection = new PDO('dblib:host=myServerHost;dbname=MyDatabase', 'username', 'pass'); Expected result: ---------------- We expect no warnings to be thrown and connection to SQL Server to work Actual result: -------------- A warning is thrown : Warning: PDO::__construct(): Called dbsetopt with parameter 3 NULL (severity 11) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63638&edit=1