note 125561 added to pdostatement.fetchall
| From: | geompse at gmail dot com | Date: | Wed, 02 Dec 2020 10:28:24 +0000 |
| Subject: | note 125561 added to pdostatement.fetchall | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-215925@lists.php.net to get a copy of this message | ||
There is a breaking change upgrading from PHP<7.4 to PHP 8.0. If your class extend PDOStatement,
the PHP 8.0 typed prototype is incompatible :
- PHP 7.4 = public PDOStatement::fetchAll ([ int $fetch_style [, mixed $fetch_argument [, array
$ctor_args = array() ]]] ) : array
- PHP 8.0 = public PDOStatement::fetchAll ([ int $mode = PDO::FETCH_BOTH[, mixed ...$args] ]) :
array
While they are compatible for a human being, PHP is not enjoying it :
- PHP 7.4 = PHP Warning: Declaration of (your class prototype) should be compatible with
(PDOStatement's prototype)
- PHP 8.0 = [PhpCompileError] Declaration of (your class prototype) must be comptable with
(PDOStatement's prototype)
Because the first one is a warning, it is not fatal, and you might be happy using PHP 8.0's
prototype. My personal solution was to stop extending PDOStatement and thus rewrite associated
typing declarations and conditions.
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.156.130 (proxied: 77.207.118.184)
----
Manual Page -- http://php.net/manual/en/pdostatement.fetchall.php
Edit -- https://master.php.net/note/edit/125561
Del: integrated -- https://master.php.net/note/delete/125561/integrated
Del: useless -- https://master.php.net/note/delete/125561/useless
Del: bad code -- https://master.php.net/note/delete/125561/bad+code
Del: spam -- https://master.php.net/note/delete/125561/spam
Del: non-english -- https://master.php.net/note/delete/125561/non-english
Del: in docs -- https://master.php.net/note/delete/125561/in+docs
Del: other reasons-- https://master.php.net/note/delete/125561
Reject -- https://master.php.net/note/reject/125561
Search -- https://master.php.net/manage/user-notes.php