diff options
author | Anatol Belski <ab@php.net> | 2018-06-29 18:35:44 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2018-06-29 18:35:44 +0200 |
commit | 486f18f09e6c9f07719e22677ac9f9b432c7980b (patch) | |
tree | 76f2660308b62d5d3ac3eb0bdf259eaae47bd76a | |
parent | 00c0d7702ce92ed132ad7234ca63bdec28e56421 (diff) | |
parent | cb97fd309790330bced04091fac46ea1466283c9 (diff) | |
download | php-git-486f18f09e6c9f07719e22677ac9f9b432c7980b.tar.gz |
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
Fixed bug #76548 pg_fetch_result did not fetch the next row
-rw-r--r-- | ext/pgsql/pgsql.c | 1 | ||||
-rw-r--r-- | ext/pgsql/tests/bug76548.phpt | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index fb29b54e87..1f88bf4205 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -2655,6 +2655,7 @@ PHP_FUNCTION(pg_fetch_result) if (pgsql_row >= PQntuples(pgsql_result)) { RETURN_FALSE; } + pg_result->row++; } else { 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, diff --git a/ext/pgsql/tests/bug76548.phpt b/ext/pgsql/tests/bug76548.phpt new file mode 100644 index 0000000000..3a0b8922e1 --- /dev/null +++ b/ext/pgsql/tests/bug76548.phpt @@ -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== |