Bug #81274 [NEW]: pg_fetch_all() last record is the same as previous one
| From: | yulkusal at gmail dot com | Date: | Mon, 19 Jul 2021 18:06:04 +0000 |
| Subject: | Bug #81274 [NEW]: pg_fetch_all() last record is the same as previous one | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-235190@lists.php.net to get a copy of this message | ||
From: yulkusal at gmail dot com
Operating system: Centos 8.4
PHP version: 7.4.21
Package: PostgreSQL related
Bug Type: Bug
Bug description:pg_fetch_all() last record is the same as previous one
Description:
------------
The last element of pg_fetch_all() array result is the same as the
previous one (n and n-1 are the same).
Using pg_fetch_assoc() shows correct information.
PHP Info:
System Linux qm 4.18.0-305.7.1.el8_4.x86_64 #1 SMP Tue Jun 29 21:55:12
UTC 2021 x86_64
Build Provider Remi's RPM repository <https://rpms.remirepo.net/>
Server API FPM/FastCGI
PHP API 20190902
PostgreSQL(libpq) Version 13.2
PostgreSQL(libpq) PostgreSQL 13.2 on x86_64-redhat-linux-gnu, compiled
by gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1), 64-bit
Postgresql Info: PostgreSQL 12.7 from postgresql repo
postgresql12.x86_64 / 12.7-2PGDG.rhel8 / @pgdg12
Test script:
---------------
$res = pg_query($db_connection, 'SELECT field01 FROM table01');
$num = pg_num_rows($res);
if($num > 0){
$arr = pg_fetch_all($res);
foreach($arr as $rec){
echo $rec['field1'] . PHP_EOL;
}
for($i = 0; $i < $num; $i++){
$rec = pg_fetch_assoc($res);
echo $rec['field1'] . PHP_EOL;
}
}
--
Edit bug report at https://bugs.php.net/bug.php?id=81274&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81274&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81274&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81274&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81274&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81274&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81274&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81274&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81274&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81274&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81274&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81274&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81274&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81274&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81274&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81274&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81274&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81274&r=mysqlcfg