|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28782 not able to reference class variables with pg_ functions
Submitted: 2004-06-14 21:34 UTC Modified: 2004-06-20 06:32 UTC
From: lbutler at intercall dot com Assigned:
Status: Not a bug Package: PostgreSQL related
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
 [2004-06-14 21:34 UTC] lbutler at intercall dot com
pg_close() and other pg_ functions unable to reference class variables as link resource. (Works with mysql_connect()) 

Reproduce code:
   class databasehandler0 
        var foo;

        function connect() 
                $this->foo = pg_connect('host=hostname dbname=database1 user=username1 password=pword1') || die ('An aweful death');

        function disconnect()

   $dbconn0 = new databasehandler0;

Expected result:
I expect to be able to reference the class var foo in pg_close() as a resource connection.

Actual result:
Warning: pg_close(): supplied argument is not a valid PostgreSQL link resource


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-14 21:39 UTC] lbutler at intercall dot com
Changed summary discription.
 [2004-06-20 06:32 UTC]
Your code is bogus. $this->foo gets the result of || operation.

This works much better :)

($this->foo = pg_connect('host=hostname dbname=database1
user=username1 password=pword1')) || die ('An aweful death');

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 16 22:01:30 2024 UTC