Doc #53707 [Asn->Csd]: Wrong function declaration of PDOStatement->execute

From: Date: Wed, 12 Jan 2011 03:58:56 +0000
Subject: Doc #53707 [Asn->Csd]: Wrong function declaration of PDOStatement->execute
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-5784@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: Assigned +Status: Closed Type: Documentation Problem Package: Documentation problem Operating System: any PHP Version: 5.3.5 Assigned To: aharvey Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2011-01-12 04:58:54] aharvey@php.net Automatic comment from SVN on behalf of aharvey Revision: http://svn.php.net/viewvc/?view=revision&revision=307396 Log: Fix doc bug #53707 (Wrong function declaration of PDOStatement->execute). ------------------------------------------------------------------------ [2011-01-12 04:57:30] aharvey@php.net 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. ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#5784) next »