Doc #81189 [Opn->Csd]: PDOStatement::fetchAll() incorrectly claims "false on failure" return
| From: | git@php.net | Date: | Mon, 20 Sep 2021 10:15:55 +0000 |
| Subject: | Doc #81189 [Opn->Csd]: PDOStatement::fetchAll() incorrectly claims "false on failure" return | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-19195@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: git@php.net
Reported by: corey dot taylor dot fl at gmail dot com
Summary: PDOStatement::fetchAll() incorrectly claims "false
on failure" return
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: PDO Core
PHP Version: 8.1.0alpha1
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmb69
Revision: https://github.com/php/doc-en/commit/c807f27964f7535f47e730c741f619d490ba04a0
Log: Fix #81189: PDOStatement::fetchAll() claims "false on failure" return
Previous Comments:
------------------------------------------------------------------------
[2021-06-29 07:28:34] nikic@php.net
Signature is correct, documentation is outdated.
------------------------------------------------------------------------
[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