php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #52003 Incorrect PDOStatement::execute() signature
Submitted: 2010-06-05 22:53 UTC Modified: 2020-04-07 11:33 UTC
Votes:6
Avg. Score:4.2 ± 0.9
Reproduced:4 of 4 (100.0%)
Same Version:4 (100.0%)
Same OS:4 (100.0%)
From: me at paulofreitas dot me Assigned: cmb (profile)
Status: Closed Package: PDO related
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: me at paulofreitas dot me
New email:
PHP Version: OS:

 

 [2010-06-05 22:53 UTC] me at paulofreitas dot me
Description:
------------
Manual says PDOStatement::execute() signature is:

bool PDOStatement::execute  ([  array $input_parameters = array()  ] )

But in fact it is:

bool PDOStatement::execute  ([  $input_parameters = null  ] )

Test script:
---------------
<?php

class DBStatement extends PDOStatement
{
    public function execute(array $input_parameters = array())
    {
        return parent::execute($input_parameters);
    }
}

$PDO = new PDO('mysql:host=127.0.0.1', 'root', '');
$PDO->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('DBStatement'));

Expected result:
----------------
No errors

Actual result:
--------------
Strict Standards: Declaration of DBStatement::execute() should be compatible with that of PDOStatement::execute() in /media/ext/Web/htdocs/test/bug.php on line 9

Patches

ZEND_ARG_ARRAY_INFO (last revision 2010-06-06 04:13 UTC by pierrick@php.net)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-06 06:13 UTC] pierrick@php.net
The following patch has been added/updated:

Patch Name: ZEND_ARG_ARRAY_INFO
Revision:   1275797622
URL:        http://bugs.php.net/patch-display.php?bug=52003&patch=ZEND_ARG_ARRAY_INFO&revision=1275797622
 [2010-10-19 07:07 UTC] kalle@php.net
-Type: Documentation Problem +Type: Bug -Package: Documentation problem +Package: PDO related -Assigned To: +Assigned To: pierrick
 [2010-10-19 07:07 UTC] kalle@php.net
Pierrick, why don't you commit that patch the src? And add a changelog entry if reasonable for PDOStatement::execute() :)
 [2012-01-30 05:52 UTC] larry at ldrutledge dot com
The situation appears to be unchanged in 5.3.9. The manual still shows a type hint of array but a method in an extended class still triggers a warning unless the type hint is omitted.
 [2012-09-09 14:37 UTC] reeze dot xia at gmail dot com
This seems been forgotten by pierrick.
 [2012-09-10 02:32 UTC] laruence@php.net
maybe change to doc problem, there maybe already some user defined their extended 
class with the *wrong* signature.
 [2012-11-17 00:58 UTC] pierrick@php.net
I never committed this patch because it was breaking some php code by adding 
strict errors. We should (as said in the previous comment) update the 
documentation.

I'm assigning this to you Ilia since you're the PDO primary maintainer. Do you 
also think it's best to just update the documentation ? Thanks for your feedback
 [2012-11-17 00:58 UTC] pierrick@php.net
-Assigned To: pierrick +Assigned To: iliaa
 [2012-11-17 01:00 UTC] iliaa@php.net
I think the patch make sense, we should update the docs to reflect the patch.
 [2012-11-17 06:08 UTC] pierrick@php.net
Ok then I'll commit it on 5.3 and > or on 5.5 and > ?
 [2013-02-06 22:44 UTC] rick at wrep dot nl
This is still not fixed in the documentation, it would be great if the 
documentation could be updated to reflect the real situation!
 [2013-02-13 23:42 UTC] me at paulofreitas dot me
-: v1d4l0k4 at gmail dot com +: me at paulofreitas dot me
 [2013-02-13 23:42 UTC] me at paulofreitas dot me
Using PHP 5.4.6 I noticed that the Strict Standards error message was improved, now it includes the expected signature, which actually helps more than before:

Strict Standards: Declaration of DBStatement::execute() should be compatible with PDOStatement::execute($bound_input_params = NULL) in Unknown on line 0

If it won't get patched, please, don't forget to update the docs! (if php-doc was already mirrored on GitHub I'd have done it myself – hint)
 [2014-01-01 12:49 UTC] felipe@php.net
-Package: PDO related +Package: PDO Core
 [2015-08-31 22:28 UTC] cmb@php.net
IMO, this is not a documentation problem, but rather an
implementation bug. While the ARG_INFO is untyped[1], the
respective ZPP expects a nullable array[2]. Actually, this
inconsistency should be fixed, instead of weakening the docs.

[1] <https://github.com/php/php-src/blob/php-7.0.0RC1/ext/pdo/pdo_stmt.c#L44-L46>
[2] <https://github.com/php/php-src/blob/php-7.0.0RC1/ext/pdo/pdo_stmt.c#L441>
 [2017-10-20 18:39 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: iliaa +Assigned To:
 [2017-10-20 18:39 UTC] kalle@php.net
Unassigning as Ilia is not currently active
 [2017-10-24 08:29 UTC] kalle@php.net
-Package: PDO Core +Package: PDO related
 [2020-04-07 11:33 UTC] cmb@php.net
-Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: cmb
 [2020-04-07 11:33 UTC] cmb@php.net
The arginfo is now fixed in master[1] (fixing it for PHP 7 would
constitute a BC break), so I'm changing to doc bug.

[1] <https://github.com/php/php-src/blob/68139dbdd89451ae804548b9726400a96aeec4fd/ext/pdo/pdo_stmt.stub.php#L40>
 [2020-04-07 11:40 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=349634
Log: Fix #52003: Incorrect PDOStatement::execute() signature
 [2020-04-07 11:42 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=aeec7fbecba3b7b274b7ed701193bcdd1cc0cc8b
Log: Fix #52003: Incorrect PDOStatement::execute() signature
 [2020-04-07 11:42 UTC] phpdocbot@php.net
-Status: Verified +Status: Closed
 [2020-04-07 16:58 UTC] mumumu@php.net
Automatic comment from SVN on behalf of mumumu
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=349640
Log: Fix #52003: Incorrect PDOStatement::execute() signature
 [2020-04-07 17:00 UTC] phpdocbot@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=becaadc6da443ac4fbe12df79dfb5a943881d35c
Log: Fix #52003: Incorrect PDOStatement::execute() signature
 [2020-12-30 11:59 UTC] nikic@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=97a9dc5227aa6092cee7199bdf17365903bc4eb9
Log: Fix #52003: Incorrect PDOStatement::execute() signature
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Nov 26 20:01:33 2024 UTC