Bug #80510 [NEW]: Error is Thrown on fetchAll on Update and Insert

From: Date: Sun, 13 Dec 2020 11:27:26 +0000
Subject: Bug #80510 [NEW]: Error is Thrown on fetchAll on Update and Insert
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231055@lists.php.net to get a copy of this message
From: max dot kaufmann at 1000eyes dot org Operating system: Ubuntu 20.04, Windows 10 PHP version: 7.4.13 Package: PDO MySQL Bug Type: Bug Bug description:Error is Thrown on fetchAll on Update and Insert Description: ------------ 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: --------------- <?php error_reporting(E_ALL); ini_set('display_errors', 1); $_Host = '127.0.0.1'; $_Port = 3306; $_Database = 'test'; $_Charset = 'utf8mb4'; $_DriverOptions = [ PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC ]; $iDSN = 'mysql:dbname=' . $_Database . ';host=' . $_Host . ';port=' . $_Port . ';charset=' . $_Charset; var_dump($iDSN); $_Hash = hash('sha512', $iDSN); try { $_ObjDb = new PDO($iDSN, 'dbuser', 'dbpassword', $_DriverOptions); } catch (Exception $e) { var_dump($e); exit('Connection to database failed.'); } $iStatement = $_ObjDb->prepare('UPDATE tabba SET name=:name WHERE id = 1'); $iName = 'Frank'; $iStatement->bindParam(':name', $iName); try { var_dump($iStatement->execute()); } catch(PDOException $e) { die($e->getMessage()); } var_dump($iStatement->rowCount()); if ($iStatement->rowCount() > 0) { var_dump($iStatement->fetchAll()); } Expected result: ---------------- In version 7.4.12 and older fetchAll() would return an empty array. Actual result: -------------- Returns an Error that something is unbuffered. -- Edit bug report at https://bugs.php.net/bug.php?id=80510&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80510&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80510&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80510&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80510&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80510&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80510&r=support Expected behavior: https://bugs.php.net/fix.php?id=80510&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80510&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80510&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80510&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80510&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80510&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80510&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80510&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80510&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80510&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80510&r=mysqlcfg

« previous php.bugs (#231055) next »