From:             novicky at aarongroup dot cz
Operating system: All
PHP version:      4.3.7
PHP Bug Type:     Informix related
Bug description:  crash during module shutdown

Description:
------------
There is a problem in function ifx_do_close which can lead to crash during
module shutdown.
The function ifx_do_close is called during shutdown from list destrucors
_close_ifx_link and _close_ifx_plink. If something goes wrong in this
function, error reporting is performed and emalloc is called. Calling
emalloc is not possible during memory destruction and can cause segfault.
It is necessary to remove all error reporting from ifx_do_close (which is
in fact useless).

Here is a patch:

--- ifx.ec.orig 2004-06-01 02:52:14.000000000 +0200
+++ ifx.ec      2004-06-22 18:46:01.000000000 +0200
@@ -295,7 +295,6 @@
        PARAMETER char *link;
 EXEC SQL END DECLARE SECTION;
 {
-       char *ifx_err = NULL;
        TSRMLS_FETCH();
 
        EXEC SQL SET CONNECTION :link;
@@ -310,32 +309,12 @@
                        if (ifx_check() == 0)   {
                                /* DISCONNECT again, after rollback */
                                EXEC SQL DISCONNECT :link;
-                               if (ifx_check() < 0)   {
-                                       IFXG(sv_sqlcode) = SQLCODE;
-                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Disconnect link %s
after Automatic Rollback fails (%s)", link, (ifx_err = ifx_error(link)));
                                }
-                       }
-                       if (ifx_check() < 0)   {
+                       else if (ifx_check() < 0)   {
                                /* CLOSE database if rollback or disconnect fails */
                                EXEC SQL CLOSE DATABASE;
-                               if (ifx_check() < 0)   {
-                                       IFXG(sv_sqlcode) = SQLCODE;
-                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Close database fails %s
(%s)", link, (ifx_err = ifx_error(link)));
-                               }
                        }
                }
-               else if (SQLCODE < 0)   {
-                       IFXG(sv_sqlcode) = SQLCODE;
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Disconnect link 
%s fails
(%s)", link, (ifx_err = ifx_error(link)));
-               }
-       }       
-       else   {
-               IFXG(sv_sqlcode) = SQLCODE;
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Set connection %s fails
(%s)", link, (ifx_err = ifx_error(link)));
-       }
-
-       if (ifx_err) {
-               efree(ifx_err);
        }
 }
 




-- 
Edit bug report at http://bugs.php.net/?id=28883&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28883&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28883&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28883&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28883&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28883&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28883&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28883&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28883&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28883&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28883&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28883&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28883&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28883&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28883&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28883&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28883&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28883&r=float

Reply via email to