php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #81189 PDOStatement::fetchAll() incorrectly claims "false on failure" return
Submitted: 2021-06-22 02:27 UTC Modified: 2021-06-29 07:28 UTC
From: corey dot taylor dot fl at gmail dot com Assigned:
Status: Closed Package: PDO Core
PHP Version: 8.1.0alpha1 OS:
Private report: No CVE-ID: None
 [2021-06-22 02:27 UTC] 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 {}




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-06-23 04:30 UTC] 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-29 07:28 UTC] nikic@php.net
Signature is correct, documentation is outdated.
 [2021-06-29 07:28 UTC] nikic@php.net
-Summary: PDOStatement::fetchAll() should return array|false +Summary: PDOStatement::fetchAll() incorrectly claims "false on failure" return -Type: Bug +Type: Documentation Problem
 [2021-09-20 10:15 UTC] git@php.net
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
 [2021-09-20 10:15 UTC] git@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 15:01:28 2024 UTC