From: uwendel at mysql dot com Operating system: Linux PHP version: 5.3CVS-2008-02-20 (CVS) PHP Bug Type: PDO related Bug description: PDO::setAttribute(PDO::ATTR_ERRMODE, <bogus>) parameter checks
Description: ------------ Question: is there consensus that PDO should use stricter parameter checking. By that I mean primarily that PDO functions follow the "modern" style of bailing out if you pass a non-scalar value parameter which expect a scalar? [1] Like this: $tmp = array() PDO->setAttribute(PDO::ATTR_ERRMODE, $tmp) If everybody agrees, Andrey or Johannes can fix this and similar minor flaws as we continue with the PDO_MYSQLND development. I guess there's a good number of similar flaws. [2] Related, what about this one: $tmp = new stdClass() PDO->setAttribute(PDO::ATTR_ERRMODE, $tmp) Reproduce code: --------------- [1] [EMAIL PROTECTED]:~/php53> sapi/cli/php -r '$pdo=new PDO("sqlite:/tmp/foo.db"); $tmp = array(); var_dump($pdo->setAttribute(PDO::ATTR_ERRMODE, $tmp));' bool(true) [2] [EMAIL PROTECTED]:~/php53> sapi/cli/php -r '$pdo=new PDO("sqlite:/tmp/foo.db"); $tmp = new stdClass(); var_dump($pdo->setAttribute(PDO::ATTR_ERRMODE, $tmp));' bool(true) (may print a notice about the implicit casting) Expected result: ---------------- Warning or similar + bool(false) -- Edit bug report at http://bugs.php.net/?id=44189&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44189&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44189&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44189&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44189&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44189&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44189&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44189&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44189&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44189&r=support Expected behavior: http://bugs.php.net/fix.php?id=44189&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44189&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44189&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44189&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44189&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44189&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44189&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44189&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44189&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44189&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44189&r=mysqlcfg