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: Open Package: PDO Core
PHP Version: 8.1.0alpha1 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: corey dot taylor dot fl at gmail dot com
New email:
PHP Version: OS:

 

 [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
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Jul 24 18:01:23 2021 UTC