#44189 [Opn]: PDO::setAttribute(PDO::ATTR_ERRMODE, <bogus>) parameter checks

From: Date: Wed, 20 Feb 2008 18:46:49 +0000
Subject: #44189 [Opn]: PDO::setAttribute(PDO::ATTR_ERRMODE, <bogus>) parameter checks
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-122518@lists.php.net to get a copy of this message
ID: 44189 User updated by: uwendel at mysql dot com Reported By: uwendel at mysql dot com Status: Open Bug Type: PDO related Operating System: Linux PHP Version: 5.3CVS-2008-02-20 (CVS) New Comment: PDO->setAttribute(PDO::ATTR_ORACLE_NULLS, <bogus>) Same story. As said, we can fix those tiny things as we go, if there's consensus to change it. Previous Comments: ------------------------------------------------------------------------ [2008-02-20 18:16:14] uwendel at mysql dot com 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] nixnutz@ulflinux:~/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] nixnutz@ulflinux:~/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 this bug report at http://bugs.php.net/?id=44189&edit=1

« previous php.bugs (#122518) next »