php.net |  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lbutler at intercall dot com
New email:
PHP Version: OS:

 

 [2004-06-14 21:34 UTC] lbutler at intercall dot com
Description:
------------
pg_close() and other pg_ functions unable to reference class variables as link resource. (Works with mysql_connect()) 

Reproduce code:
---------------
<?php
   class databasehandler0 
   {
        var foo;

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

        function disconnect()
        {
                pg_close($this->foo);
        }

   }
     
   $dbconn0 = new databasehandler0;
   $dbconn0->connect();
   $dbconn0->disconnect();
   
?>

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-14 21:39 UTC] lbutler at intercall dot com
Changed summary discription.
 [2004-06-20 06:32 UTC] edink@php.net
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: Wed Jun 19 04:01:31 2024 UTC