mirror of
https://github.com/php/php-src.git
synced 2026-04-21 06:51:18 +02:00
1f42777927
The DB connection should be provided in all cases as the first argument. The overloaded function signatures will be removed in the future. Warn about this change. Part of https://wiki.php.net/rfc/deprecations_php_8_1.
61 lines
889 B
PHP
61 lines
889 B
PHP
--TEST--
|
|
Bug #27597 (pg_fetch_array not returning false)
|
|
--EXTENSIONS--
|
|
pgsql
|
|
--SKIPIF--
|
|
<?php
|
|
require_once('skipif.inc');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
require_once(__DIR__ . '/config.inc');
|
|
|
|
$dbh = @pg_connect($conn_str);
|
|
if (!$dbh) {
|
|
die ("Could not connect to the server");
|
|
}
|
|
|
|
@pg_query($dbh, "DROP TABLE id");
|
|
pg_query($dbh, "CREATE TABLE id (id INT)");
|
|
|
|
for ($i=0; $i<4; $i++) {
|
|
pg_query($dbh, "INSERT INTO id (id) VALUES ($i)");
|
|
}
|
|
|
|
function xi_fetch_array($res, $type = PGSQL_ASSOC) {
|
|
$a = pg_fetch_array($res, NULL, $type) ;
|
|
return $a ;
|
|
}
|
|
|
|
$res = pg_query($dbh, "SELECT * FROM id");
|
|
$i = 0; // endless-loop protection
|
|
while($row = xi_fetch_array($res)) {
|
|
print_r($row);
|
|
if ($i++ > 4) {
|
|
echo "ENDLESS-LOOP";
|
|
exit(1);
|
|
}
|
|
}
|
|
|
|
pg_close($dbh);
|
|
|
|
?>
|
|
--EXPECT--
|
|
Array
|
|
(
|
|
[id] => 0
|
|
)
|
|
Array
|
|
(
|
|
[id] => 1
|
|
)
|
|
Array
|
|
(
|
|
[id] => 2
|
|
)
|
|
Array
|
|
(
|
|
[id] => 3
|
|
)
|