|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-06-20 18:27 UTC] sniper@php.net
[2001-06-27 01:57 UTC] danbeck@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 00:00:01 2025 UTC |
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