From: Operating system: CentOS 5.6 & 6 PHP version: trunk-SVN-2011-09-08 (SVN) Package: PDO related Bug Type: Bug Bug description:PDOStatement::execute() returns false when executing an UPDATE stored procedure
Description: ------------ When using PDO dblib, PDOStatement::execute() is returning false with a stored procedure that only contains an UPDATE statement. The procedure actually succeeds and modifies the data as expected. I discovered this issue because we upgraded to PHP 5.3.8 from 5.3.6 using the RPMs from the Remi repository. I looked at the RPM spec file and this patch is being applied for PHP bug #50755: https://raw.github.com/remicollet/remirepo/master/php/php-5.3.7-pdo-dblib-50755.patch According to the comments in the spec file, the patch is based off the following commits: http://svn.php.net/viewvc?view=revision&revision=300002 http://svn.php.net/viewvc?view=revision&revision=300089 http://svn.php.net/viewvc?view=revision&revision=300646 http://svn.php.net/viewvc?view=revision&revision=300791 Before reporting a bug to the Remi repository, I decided that I would try to duplicate the bug in PHP-trunk and I was able to. Our environment: MSSQL 2008 FreeTDS 0.82 (from the EPEL repo) PHP-trunk CentOS 5.6 Here is a simple example of the type of stored procedure that we are using. CREATE PROCEDURE [dbo].[TestProc] @iID integer, @sFoo varchar(max) AS BEGIN UPDATE TestTable SET foo = @sFoo WHERE id = @iID; END The stored procedure does not return any results, yet is executed successfully. PDOStatement::execute() returns false, but it returns true in vanilla PHP 5.3.8. It seems that since the procedure does not return any results, it causes PDOStatement::execute() to return false not true. Test script: --------------- <?php $db = new PDO($dsn, $username, $password); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = 'EXEC TestProc ?, ?'; $stmt = $db->prepare($sql); $id = 123; $foo = 'Hello ...'; $stmt->bindParam(1, $id, PDO::PARAM_INT); $stmt->bindParam(2, $foo, PDO::PARAM_STR); $ret = $stmt->execute(); var_dump($ret); ?> Expected result: ---------------- bool(true) Actual result: -------------- bool(false) -- Edit bug report at https://bugs.php.net/bug.php?id=55647&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55647&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55647&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55647&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=55647&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55647&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=55647&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=55647&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=55647&r=needscript Try newer version: https://bugs.php.net/fix.php?id=55647&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=55647&r=support Expected behavior: https://bugs.php.net/fix.php?id=55647&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=55647&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=55647&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=55647&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55647&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=55647&r=dst IIS Stability: https://bugs.php.net/fix.php?id=55647&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=55647&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=55647&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=55647&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=55647&r=mysqlcfg