romolo          Mon Mar 26 00:00:44 2001 EDT

  Modified files:              
    /php4/ext/pgsql     pgsql.c 
  Log:
  
  pg_close was undefining default_conn even if a ref to it was still there.
  
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.94 php4/ext/pgsql/pgsql.c:1.95
--- php4/ext/pgsql/pgsql.c:1.94 Sat Mar 24 10:36:43 2001
+++ php4/ext/pgsql/pgsql.c      Mon Mar 26 00:00:43 2001
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
  
-/* $Id: pgsql.c,v 1.94 2001/03/24 18:36:43 romolo Exp $ */
+/* $Id: pgsql.c,v 1.95 2001/03/26 08:00:43 romolo Exp $ */
 
 #include <stdlib.h>
 
@@ -501,7 +501,8 @@
 PHP_FUNCTION(pg_close)
 {
        zval **pgsql_link = NULL;
-       int id;
+       void *ptr;
+       int id, type;
        PGconn *pgsql;
        PGLS_FETCH();
        
@@ -527,12 +528,15 @@
 
        if (id==-1) { /* explicit resource number */
                zend_list_delete(Z_RESVAL_PP(pgsql_link));
+               ptr = zend_list_find(Z_RESVAL_PP(pgsql_link),&type);
+               if (ptr && (type==le_link || type==le_plink)) {
+                       RETURN_TRUE;
+               }                
        }
 
        if (id!=-1 
                || (pgsql_link && Z_RESVAL_PP(pgsql_link)==PGG(default_link))) {
-               if (id!=-1)
-                       zend_list_delete(PGG(default_link));
+               zend_list_delete(PGG(default_link));
                PGG(default_link) = -1;
        }
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to