PHP 4.0 Bug #10153: Resource lost on the way..
| From: | romolo at bicnet dot it | Date: | Wed, 04 Apr 2001 09:09:29 +0000 |
| Subject: | PHP 4.0 Bug #10153: Resource lost on the way.. | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-50812@lists.php.net to get a copy of this message | ||
From: romolo@bicnet.it
Operating system: linux
PHP version: 4.0 Latest CVS (04/04/2001)
PHP Bug Type: PostgreSQL related
Bug description: Resource lost on the way..
Executing this script generate the error:
Warning: 1 is not a valid PostgreSQL link resource in test.php on line 24
The main problem is that adding a little bit of code to php source to printout the refcount of the
resource just after the pg_connect get executed and zend_list_addref get called
and just before the pg_exec get really executed i obtain the output at the end of the script, please
not how refcount magically decrease between the pg_connect and the pg_exec.
The script...
<?php
//
// Test script to show the bug
//
$db1=pg_connect("dbname=test");
$res1=pg_exec($db1,"SELECT * from tbltest");
echo "1 ".$db1."<br>";
$db=pg_connect("dbname=test");
$res1=pg_exec($db,"SELECT * from tbltest");
echo "2 ".$db."<br>";
pg_close($db);
$db=pg_connect("dbname=test");
$res1=pg_exec($db,"SELECT * from tbltest");
echo "3 ".$db."<br>";
pg_close($db);
$db=pg_connect("dbname=test");
$res1=pg_exec($db,"SELECT * from tbltest");
echo "4 ".$db."<br>";
pg_close($db);
pg_close($db1);
?>
The output:
Warning: Refcount 2 in /usr/local/httpd/htdocs/test.php on line 6
1 Resource id #1
Warning: Refcount 3 in /usr/local/httpd/htdocs/test.php on line 9
Warning: Refcount 3 in /usr/local/httpd/htdocs/test.php on line 10
2 Resource id #1
Warning: Refcount 3 in /usr/local/httpd/htdocs/test.php on line 14
Warning: Refcount 3 in /usr/local/httpd/htdocs/test.php on line 15
3 Resource id #1
Warning: Refcount 3 in /usr/local/httpd/htdocs/test.php on line 19
Warning: Refcount 2 in /usr/local/httpd/htdocs/test.php on line 20
4 Resource id #1
Warning: 1 is not a valid PostgreSQL link resource in
/usr/local/httpd/htdocs/test.php on line 24
--
Edit Bug report at: http://bugs.php.net/?id=10153&edit=1