]> granicus.if.org Git - php/commitdiff
in an rshutdown function we should not access the regular_list like this.
authorThies C. Arntzen <thies@php.net>
Sat, 15 Jan 2000 13:35:06 +0000 (13:35 +0000)
committerThies C. Arntzen <thies@php.net>
Sat, 15 Jan 2000 13:35:06 +0000 (13:35 +0000)
ext/odbc/php_odbc.c

index 691f7765e5a8e8c8c3e39a91bbb284ec440d4cec..aaa31503fcb0c7e73b0a1b479e52e5b9c684169e 100644 (file)
@@ -410,6 +410,17 @@ PHP_MINIT_FUNCTION(odbc)
        return SUCCESS;
 }
 
+void _php_odbc_shutdown(void *data)
+{
+       ELS_FETCH();
+       
+       /* Close all statements before connection */
+       
+       /* this is not the nice way of doing it - we should use reference counting
+          of the parent handles */
+
+       zend_hash_apply(&EG(regular_list), (int (*)(void *)) _odbc_stmt_cleanup);
+}
 
 PHP_RINIT_FUNCTION(odbc)
 {
@@ -417,15 +428,14 @@ PHP_RINIT_FUNCTION(odbc)
        
        ODBCG(defConn) = -1;
        ODBCG(num_links) = ODBCG(num_persistent);
+
+       php_register_pre_request_shutdown(_php_odbc_shutdown, NULL);
+
        return SUCCESS;
 }
 
 PHP_RSHUTDOWN_FUNCTION(odbc)
 {
-       ELS_FETCH();
-       
-       /* Close all statements before connection */
-       zend_hash_apply(&EG(regular_list), (int (*)(void *)) _odbc_stmt_cleanup);
        return SUCCESS;
 }