note 101777 added to pdostatement.execute
| From: | RobinMillette at osu1 dot php dot net | Date: | Tue, 11 Jan 2011 02:30:00 +0000 |
| Subject: | note 101777 added to pdostatement.execute | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-175618@lists.php.net to get a copy of this message | ||
If you're going to derive PDOStatement to extend the execute() method, you must define the
signature with a default NULL argument, not an empty array.
In otherwords:
<?php
class MyPDOStatement extends PDOStatement {
// ...
// don't use this form!
// function execute($input_parameters = array()) {
// use this instead:
function execute($input_parameters = null) {
// ...
return parent::execute($input_parameters);
}
}
?>
As a sidenote, that's why I always set default parameter to NULL and take care of handling the
actual correct default parameters in the body of the method or function. Thus, when you have to call
the function with all the parameters, you know to always pass NULL for defaults.
----
Server IP: 66.207.199.35
Probable Submitter: 67.55.31.129
----
Manual Page -- http://www.php.net/manual/en/pdostatement.execute.php
Edit -- https://master.php.net/note/edit/101777
Del: integrated -- https://master.php.net/note/delete/101777/integrated
Del: useless -- https://master.php.net/note/delete/101777/useless
Del: bad code -- https://master.php.net/note/delete/101777/bad+code
Del: spam -- https://master.php.net/note/delete/101777/spam
Del: non-english -- https://master.php.net/note/delete/101777/non-english
Del: in docs -- https://master.php.net/note/delete/101777/in+docs
Del: other reasons-- https://master.php.net/note/delete/101777
Reject -- https://master.php.net/note/reject/101777
Search -- https://master.php.net/manage/user-notes.php