php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14383 using postgres with DBA causes DBA not to be able to find any keys.
Submitted: 2001-12-07 14:37 UTC Modified: 2003-05-19 18:13 UTC
From: gclarkii at vsservices dot com Assigned: helly (profile)
Status: Closed Package: DBM/DBA related
PHP Version: 4.2.0-dev OS: FreeBSD 4.4-STABLE
Private report: No CVE-ID: None
 [2001-12-07 14:37 UTC] gclarkii at vsservices dot com
Hello,

If I use postgres first within a PHP script then DBA can not find any keys.  

It will return the error:
"Warning: Unable to find DBA identifier 1 in /www/sites/Test/htdocs/dbafuncs.php on line 31"

If I do not use a pg_connect, then it works perfectly.

Here is a short script that triggers it.

--SNIP--
$dbh = pg_connect("dbname=helpme user=helpme");
 
  if (!$dbh) {
    die ("Could not connect to the server");
  }
 
pg_close($dbh);
 
$dbalocation = "/www/sites/Test/xxadmindb";
echo "$dbalocation<br><br>";
 
$dbm = dba_open("$dbalocation", "r", "ndbm") || die ("Could not open file");
 
  if(!$dbm) {
    die ("no handle");
  }
 
$key = dba_firstkey($dbm);
 
  if(!$key) {
    echo "<br><br>Error with retreiving Key<br><br>\n";
  }
 
$info[$key] = dba_fetch($key, $dbm);
 
  while($key != false) {
    $key = dba_nextkey($dbm);
      if(!$key) { break; }
    $info[$key] = dba_fetch($key, $dbm);
  }
 
dba_close($dbm);

--SNIP--

The dba_open works just fine and returns a handle, however anything that needs a key will fail with the above error.

GB Clark

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-12 03:42 UTC] yohgaki@php.net
Just trying to clarify. 
If you don't use postgresql functions *before* dba functions, your script works as expected?

Could you try it with 4.1.0 to see it helps?

--
Yasuo 


 [2001-12-13 02:33 UTC] gclarkii at vsservices dot com
Yes, if I don't use any postgres commands then the dba stuff works fine.  

GB
 [2001-12-13 02:39 UTC] yohgaki@php.net
Did you try it with 4.1.0? Do you still have the problem?
If you still have problem, could you try snapshot also?

http://snaps.php.net/

If you still have problem with snapshot, I'll look into what's wrong.
 [2001-12-13 02:51 UTC] gclarkii at vsservices dot com
No, I've not tried it with 4.1.0.

I'm trying to get it or one of the snaps right now and
the servers are slllowwww...:(
Will report back when I get it tested.

--
GB

 [2001-12-13 03:17 UTC] gclarkii at vsservices dot com
Ok,
I just tested it with 4.1.0 and I still get the exact same
error,  no change.

I'll try to get a snap if I can and try it.

 [2001-12-13 03:29 UTC] gclarkii at vsservices dot com
Hi,
Yes the latest snapshop has the same error.
Again, if I comment out the pg_connect call it
works just fine.


 [2001-12-13 04:40 UTC] yohgaki@php.net
Thanks a lot.
I'll take a look at source.  It could be hard to figure out 
what's wrong. Please be patient. 
Since I don't use FreeBSD, I might ask something later.
 [2002-11-06 06:00 UTC] helly@php.net
For me it works, i think.

Could you please try latest cvs version copy new test below to ext/pgsql/tests/30_bug14383.phpt and run the following test script using: 
php run-tests.php ext/pgsql

===ext/pgsql/tests/30_bug14383.phpt============
--TEST--
Bug 14383
--SKIPIF--
<?php 
require_once(dirname(__FILE__).'/../../dba/tests/skipif.inc');
require_once('skipif.inc');
?>
--FILE--
<?php
require_once('config.inc');
	
$dbh = @pg_connect($conn_str);
if (!$dbh) {
	die ("Could not connect to the server");
}
pg_close($dbh);

require_once(dirname(__FILE__).'/../../dba/tests/test.inc');
require_once(dirname(__FILE__).'/../../dba/tests/dba_handler.inc');

?>
--EXPECTF--
database handler: %s
3NYNYY
Content String 2
Content 2 replaced
Read during write permitted
Content 2 replaced 2nd time
The 6th value
array(3) {
  ["key number 6"]=>
  string(13) "The 6th value"
  ["key2"]=>
  string(27) "Content 2 replaced 2nd time"
  ["key5"]=>
  string(23) "The last content string"
}
===EOF ext/pgsql/tests/30_bug14383.phpt========

 [2003-01-11 11:49 UTC] helly@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2003-05-19 18:13 UTC] helly@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 08:01:27 2024 UTC