#28782 [Opn->Bgs]: not able to reference class variables with pg_ functions
| From: | edink@php.net | Date: | Sun, 20 Jun 2004 04:32:54 +0000 |
| Subject: | #28782 [Opn->Bgs]: not able to reference class variables with pg_ functions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-61110@lists.php.net to get a copy of this message | ||
ID: 28782
Updated by: edink@php.net
Reported By: lbutler at intercall dot com
-Status: Open
+Status: Bogus
Bug Type: PostgreSQL related
Operating System: Linux
PHP Version: Irrelevant
New Comment:
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');
Previous Comments:
------------------------------------------------------------------------
[2004-06-14 21:39:48] lbutler at intercall dot com
Changed summary discription.
------------------------------------------------------------------------
[2004-06-14 21:34:42] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28782&edit=1