Bug->Doc #81189 [Opn]: PDOStatement::fetchAll() incorrectly claims "false on failure" return
| From: | nikic@php.net | Date: | Tue, 29 Jun 2021 07:28:34 +0000 |
| Subject: | Bug->Doc #81189 [Opn]: PDOStatement::fetchAll() incorrectly claims "false on failure" return | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-18909@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81189&edit=1
ID: 81189
Updated by: nikic@php.net
Reported by: corey dot taylor dot fl at gmail dot com
-Summary: PDOStatement::fetchAll() should return array|false
+Summary: PDOStatement::fetchAll() incorrectly claims "false
on failure" return
Status: Open
-Type: Bug
+Type: Documentation Problem
Package: PDO Core
PHP Version: 8.1.0alpha1
Block user comment: N
Private report: N
New Comment:
Signature is correct, documentation is outdated.
Previous Comments:
------------------------------------------------------------------------
[2021-06-23 04:30:04] corey dot taylor dot fl at gmail dot com
I see that https://github.com/php/php-src/commit/a5cf82802d097f7c327ee7e4eafe2224a5c9f78b
changed the return types.
I assume this was on purpose. I didn't find any notes regarding the type changes.
------------------------------------------------------------------------
[2021-06-22 02:27:33] corey dot taylor dot fl at gmail dot com
Description:
------------
The new tentative return type for fetchAll() is just array, but it's documented as array|false.
https://www.php.net/manual/en/pdostatement.fetchall.php
An empty array is returned if there are zero results to fetch, or false on failure.
https://github.com/php/php-src/blob/master/ext/pdo/pdo_stmt.stub.php#L40
/** @tentative-return-type */
public function fetchAll(int $mode = PDO::FETCH_DEFAULT, mixed ...$args): array {}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81189&edit=1