Doc #53707 [Opn->Asn]: Wrong function declaration of PDOStatement->execute
| From: | aharvey@php.net | Date: | Wed, 12 Jan 2011 03:57:30 +0000 |
| Subject: | Doc #53707 [Opn->Asn]: Wrong function declaration of PDOStatement->execute | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-5783@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53707&edit=1
ID: 53707
Updated by: aharvey@php.net
Reported by: info at a2er dot ch
Summary: Wrong function declaration of PDOStatement->execute
-Status: Open
+Status: Assigned
Type: Documentation Problem
Package: Documentation problem
Operating System: any
PHP Version: 5.3.5
-Assigned To:
+Assigned To: aharvey
Block user comment: N
Private report: N
New Comment:
Looking at the implementation, execute() doesn't really have a default
value as such: the optional parameter is either set or not. I'll remove
the default value from the manual.
Previous Comments:
------------------------------------------------------------------------
[2011-01-10 16:08:43] info at a2er dot ch
Description:
------------
---
From manual page: http://www.php.net/pdostatement.execute#Description
---
Argument $input_parameters can not be an array as default value.
Mustn't it be:
bool PDOStatement::execute ([ array $input_parameters = NULL ] )
Test script:
---------------
function execute(PDOStatement $statement, array $input_parameters =
array())
{
$statement->execute($input_parameters);
}
$pdo = new PDO("mysql:dbname=database;host=localhost", "user",
"pass");
$statement = $pdo->prepare("SELECT * FROM
table WHERE name = :name");
$statement->bindValue("name", "Peter");
execute($statement);
Expected result:
----------------
Query should be executed.
Actual result:
--------------
Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter
number: no parameters were bound in /var/www/wm2/public/testscript.php
on line 5
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53707&edit=1