#28883 [Fbk->Opn]: [PATCH] fix for crash during module shutdown
| From: | novicky at aarongroup dot cz | Date: | Fri, 04 Feb 2005 17:31:30 +0000 |
| Subject: | #28883 [Fbk->Opn]: [PATCH] fix for crash during module shutdown | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-73482@lists.php.net to get a copy of this message | ||
ID: 28883
User updated by: novicky at aarongroup dot cz
Reported By: novicky at aarongroup dot cz
-Status: Feedback
+Status: Open
Bug Type: Informix related
Operating System: All
-PHP Version: 4.3.7
+PHP Version: 4.3.10
New Comment:
The problem still persists. There is no change even in latest CVS.
The function php_error_docref cannot be used within resource
destructors. The submitted patch simply removes error reporting from
destructor.
Previous Comments:
------------------------------------------------------------------------
[2005-02-03 05:04:08] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
[2004-06-22 19:08:12] novicky at aarongroup dot cz
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 this bug report at http://bugs.php.net/?id=28883&edit=1