From: osc at zoyo dot info Operating system: Windowx XP x86 SP2 PHP version: 5.2.5 PHP Bug Type: PDO related Bug description: PDOStatement::exec() returns int(1) to any successful query.
Description: ------------ PDOStatement::exec() returns int(1) to any successful query. I have tried it with PDO drivers for postgresql packaged with PHP version 5.2.5 on Windows XP, and version 5.1.4 on Linux. The method returns number of affected records on Linux, but returns int(1) to any successful query on Windows. PostgreSQL version is 8.2.6 for Win32. Reproduce code: --------------- <?php /* create table test( tm timestamp ); */ try{ $db = new PDO(PDOSTR,DBUSER,DBPASS); $insert1 = $db->exec('insert into test values( now() )'); $insert2 = $db->exec("insert into test values( now()+interval '1 day' )"); $update = $db->exec("update test set tm=now() + interval '2 day'"); $select = $db->exec('select * from test'); $delete = $db->exec('delete from test'); }catch(PDOException $e){ echo $e->getMessage(); exit; } ?> insert1: <?=$insert1?> insert2: <?=$insert2?> update : <?=$update?> select : <?=$select?> delete : <?=$delete?> Expected result: ---------------- insert1: 1 insert2: 1 update : 2 select : 0 delete : 2 Actual result: -------------- insert1: 1 insert2: 1 update : 1 select : 1 delete : 1 -- Edit bug report at http://bugs.php.net/?id=44310&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44310&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44310&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44310&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44310&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44310&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44310&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44310&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44310&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44310&r=support Expected behavior: http://bugs.php.net/fix.php?id=44310&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44310&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44310&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44310&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44310&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44310&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44310&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44310&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44310&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44310&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44310&r=mysqlcfg