PHP 4.0 Bug #7687 Updated: Another not a valid postgresql index
| From: | mrobinso@php.net | Date: | Tue, 07 Nov 2000 23:25:09 +0000 |
| Subject: | PHP 4.0 Bug #7687 Updated: Another not a valid postgresql index | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-37393@lists.php.net to get a copy of this message | ||
ID: 7687
Updated by: mrobinso
Reported By: mrbig@sch.bme.hu
Status: Feedback
Bug Type: PostgreSQL related
Assigned To:
Comments:
Is it possible for you to try a newer version of PHP?
You can download a snapshot here:
http://snaps.php.net
I think there is a fix in CVS related to this.
You might want to note that the syntax you are using in
your pg_connect() call has been deprecated. There is info
at http://www.php.net/manual/ref.pgsql.php
related to this.
Previous Comments:
---------------------------------------------------------------------------
[2000-11-07 23:43:57] mrbig@sch.bme.hu
Another the same problem, I've tried to write a script that cleanly reproduces what happened:
<?
$dblocation="localhost";
$dbname="mydb";
function TryHere () {
global $dblocation, $dbname;
$database=pg_Connect($dblocation,"","",$dbname);
$datein=pg_exec($database,"select datetime 'now';");
pg_Close($database);
$file=fopen('/tmp/some.file.txt','r');
if (pg_NumRows($datein)) {
$row=pg_Fetch_Array($datein,0);
echo "Date is: $row[0]<br>n";
}
fclose($file);
#
# Everything worked fine
#
}
function TryHereAgain () {
global $dblocation, $dbname;
$database=pg_Connect($dblocation,"","",$dbname);
$datein=pg_exec($database,"select datetime 'now';");
pg_Close($database);
if (pg_NumRows($datein)) {
$row=pg_Fetch_Array($datein,0);
echo "Date is: $row[0]<br>n";
}
#
# Mmm... Not anymore :(
#
}
TryHere();
TryHereAgain();
?>
If I ommit to open a file, or to use any of the pg_NumRows or pg_Fetch_Array at the first call of
the routine everything is ok. Also if I do the same things, but without functions. Quite
interesting...
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7687