|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80510 Error is Thrown on fetchAll on Update and Insert
Submitted: 2020-12-13 11:27 UTC Modified: 2020-12-13 11:40 UTC
From: max dot kaufmann at 1000eyes dot org Assigned:
Status: Duplicate Package: PDO MySQL
PHP Version: 7.4.13 OS: Ubuntu 20.04, Windows 10
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: max dot kaufmann at 1000eyes dot org
New email:
PHP Version: OS:


 [2020-12-13 11:27 UTC] max dot kaufmann at 1000eyes dot org
This Bugs happens in Version 7.4.13 and 8.0.0.

You also need to Create a Table like:
CREATE TABLE tabba (id int AUTO_INCREMENT, name varchat(32) NOT NULL);

And insert something in it:
INSERT INTO tabba (name) VALUES ("Franc");

It is possible to remove the Error an go back to expected behavior when removing "PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION".
But is more or less only a workaround.

This Bug break functions like Query which creates an PDO Statement and returns an array of the fetchAll result.

Test script:

ini_set('display_errors', 1);

$_Host = '';
$_Port = 3306;
$_Database = 'test';
$_Charset = 'utf8mb4';
$_DriverOptions =
        PDO::ATTR_EMULATE_PREPARES => false,

$iDSN = 'mysql:dbname=' . $_Database . ';host=' . $_Host . ';port=' . $_Port . ';charset=' . $_Charset;
$_Hash = hash('sha512', $iDSN);

try {
    $_ObjDb = new PDO($iDSN, 'dbuser', 'dbpassword', $_DriverOptions);
} catch (Exception $e) {
    exit('Connection to database failed.');

$iStatement = $_ObjDb->prepare('UPDATE tabba SET name=:name WHERE id = 1');
$iName = 'Frank';
$iStatement->bindParam(':name', $iName);

try {
catch(PDOException $e) {

if ($iStatement->rowCount() > 0) {

Expected result:
In version 7.4.12 and older fetchAll() would return an empty array.

Actual result:
Returns an Error that something is unbuffered.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-12-13 11:40 UTC]
-Status: Open +Status: Duplicate
 [2020-12-13 11:40 UTC]
Duplicate of 80458. 
The issue was that there is no result returned from MySQL for INSERT/UPDATE queries. Trying to fetch the result would throw an error using emulated prepared statements already, but given that people expect an empty result we fixed both in 7.4.14 to return an empty array if there are no results.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 08:01:29 2024 UTC