[php-src] Issue #15967: pdo_oci poiting all records to the last resource blob when using fetchAll

From: Date: Fri, 20 Sep 2024 21:06:43 +0000
Subject: [php-src] Issue #15967: pdo_oci poiting all records to the last resource blob when using fetchAll
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247839@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/15967 Author: diogotoscano ### Description The following code: ```php <?php $pdo = new PDO("oci:dbname=3.209.153.162/XEPDB1", "USU_19013", "Lookupsc.1"); $pdo->setAttribute(PDO::ATTR_AUTOCOMMIT, false); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); //doesnt work $stm = $pdo->query("SELECT PICTURE FROM USU_19013.CATEGORIES"); foreach($stm->fetchAll(PDO::FETCH_NUM ) as $row) { if(is_resource($row[0])) { $blob = stream_get_contents($row[0]); echo strlen($blob); } echo "<br>"; } echo "-----------------------------------<br>"; //works $stmt = $pdo->query("SELECT PICTURE FROM USU_19013.CATEGORIES"); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $blob = stream_get_contents($row[0]); echo strlen($blob); echo "<br>"; } ``` Resulted in this output: ``` 6592 6592 6592 6592 6592 6592 6592 6592 ----------------------------------- 805361 12984 29416 6768 9104 16652 8864 6592 ``` But I expected this output instead: ``` 805361 12984 29416 6768 9104 16652 8864 6592 ----------------------------------- 805361 12984 29416 6768 9104 16652 8864 6592 ``` ### PHP Version 8.1.28 ### Operating System Windows NT DESKTOP-VKLN5U7 10.0 build 22631 (Windows 11) AMD64

« previous php.bugs (#247839) next »