|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-09-24 15:47 UTC] alec at alec dot pl
[2015-12-11 18:10 UTC] nikic@php.net
-Status: Open
+Status: Duplicate
[2015-12-11 18:10 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 02:00:01 2025 UTC |
Description: ------------ I've created a class that extends PDO and a class that extends PDOStatement. When upgrading to PHP 7.0 RC2, it gave me a strict warning on a code that gave no issues before. What is particular is that the result error says that on line 90 is where the error occurred, but that's wrong as it contains the ending bracket of the Statement class and thus is incorrect hoping that this error is also unexpected behavior. Cause all I wanted to do is to let the PDO "execute" method do more then default. Just because the method shares the same name, doesn't mean it must share the same arguments (at least in my opinion). Test script: --------------- <?php class Statement extends PDOStatement{ public function execute(...$args){ #because this arg list is different from pdo arg list it gives a strict error. # do stuff parent::execute(); } public function __construct($handle){} } class Database extends PDO{ function __construct(){ parent::__construct($dsn, $username, $password, [parent::ATTR_STATEMENT_CLASS => ['Statement', [$this]]]); } } ?> Expected result: ---------------- I expect to see no strict errors ;) Actual result: -------------- Warning: Declaration of Statement::execute(...$args) should be compatible with PDOStatement::execute($bound_input_params = NULL) in /path/to/statement.php on line 90