mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Fixed bug #76548 pg_fetch_result did not fetch the next row
This commit is contained in:
parent
bf5a802f5a
commit
cb97fd3097
@ -2669,6 +2669,7 @@ PHP_FUNCTION(pg_fetch_result)
|
|||||||
if (pgsql_row >= PQntuples(pgsql_result)) {
|
if (pgsql_row >= PQntuples(pgsql_result)) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
pg_result->row++;
|
||||||
} else {
|
} else {
|
||||||
if (row < 0 || row >= PQntuples(pgsql_result)) {
|
if (row < 0 || row >= PQntuples(pgsql_result)) {
|
||||||
php_error_docref(NULL, E_WARNING, "Unable to jump to row " ZEND_LONG_FMT " on PostgreSQL result index " ZEND_LONG_FMT,
|
php_error_docref(NULL, E_WARNING, "Unable to jump to row " ZEND_LONG_FMT " on PostgreSQL result index " ZEND_LONG_FMT,
|
||||||
|
23
ext/pgsql/tests/bug76548.phpt
Normal file
23
ext/pgsql/tests/bug76548.phpt
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
--TEST--
|
||||||
|
Bug #76548 pg_fetch_result did not fetch the next row
|
||||||
|
--SKIPIF--
|
||||||
|
<?php include("skipif.inc"); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
include('config.inc');
|
||||||
|
|
||||||
|
$conn = pg_connect($conn_str);
|
||||||
|
|
||||||
|
$result = pg_query($conn, 'SELECT v FROM (VALUES (1), (2), (3)) AS t(v)');
|
||||||
|
|
||||||
|
while ($value = pg_fetch_result($result, 0)) {
|
||||||
|
var_dump($value); // should be 1, 2 then 3.
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
==DONE==
|
||||||
|
--EXPECTF--
|
||||||
|
string(1) "1"
|
||||||
|
string(1) "2"
|
||||||
|
string(1) "3"
|
||||||
|
==DONE==
|
Loading…
Reference in New Issue
Block a user