Edit report at http://bugs.php.net/bug.php?id=54545&edit=1
ID: 54545 Updated by: johan...@php.net Reported by: php at bucksvsbytes dot com Summary: PDO::query throws exceptions with null optional arguments Status: Open Type: Bug Package: PDO related Operating System: ubuntu PHP Version: 5.3.6 Block user comment: N Private report: N New Comment: Which driver are you using? What's the PHP configure line? And well ... verification on 5.3.6 or svn snapshot would be great ... Please also mind that if you're using distribution packages you might issues due to their patches, which we can't verify. Previous Comments: ------------------------------------------------------------------------ [2011-04-16 07:59:11] php at bucksvsbytes dot com 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 this bug report at http://bugs.php.net/bug.php?id=54545&edit=1