From: Operating system: ubuntu PHP version: 5.3.6 Package: PDO related Bug Type: Bug Bug description:PDO::query throws exceptions with null optional arguments
Description: ------------ In 5.3.3 (sorry, I can't load 5.3.6 to confirm), supplying the optional fetchmode arguments (args 2,3,4) as NULL throws fatal exceptions. In 5.2, those arguments as NULL were ignored. Optional arguments supplied as NULL should always be ignored unless the NULL is significant to the logic. It looks to me like you now have to call PDO::query with exactly the right number of arguments (1, 2, 3, or 4) to avoid bombing the script. Test script: --------------- $db=new PDO($dsn); unset($fetchmode,$fetch2,$fetch3); $db->query('select * from table',$fetchmode,$fetch2,$fetch3); //throws fatal exception $fetchmode=0; $db->query('select * from table',$fetchmode,$fetch2,$fetch3); //throws different fatal exception Expected result: ---------------- I expect query to ignore fetchmode when it is null. Actual result: -------------- query fails fatally -- Edit bug report at http://bugs.php.net/bug.php?id=54545&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54545&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54545&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54545&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54545&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54545&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54545&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54545&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54545&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54545&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54545&r=support Expected behavior: http://bugs.php.net/fix.php?id=54545&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54545&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54545&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54545&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54545&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54545&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54545&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54545&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54545&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54545&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54545&r=mysqlcfg