php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #53707 Wrong function declaration of PDOStatement->execute
Submitted: 2011-01-10 16:08 UTC Modified: 2011-01-12 04:58 UTC
From: info at a2er dot ch Assigned: aharvey (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3.5 OS: any
Private report: No CVE-ID: None
 [2011-01-10 16:08 UTC] 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 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-12 04:57 UTC] aharvey@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: aharvey
 [2011-01-12 04:57 UTC] 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-12 04:58 UTC] 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:58 UTC] aharvey@php.net
-Status: Assigned +Status: Closed
 [2011-01-12 04:58 UTC] aharvey@php.net
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.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 21:00:02 2026 UTC