Edit report at https://bugs.php.net/bug.php?id=81189&edit=1
ID: 81189
Updated by: [email protected]
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] [email protected]
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.