tony2001                Mon May 16 04:55:32 2005 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src    NEWS 
    /php-src/ext/standard       basic_functions.c 
    /php-src/main       main.c php_streams.h streams.c 
  Log:
  MFH: fix bug #32742 (segmentation fault when the stream with a wrapper is not 
closed)
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.903&r2=1.1247.2.904&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.903 php-src/NEWS:1.1247.2.904
--- php-src/NEWS:1.1247.2.903   Fri May 13 19:11:17 2005
+++ php-src/NEWS        Mon May 16 04:55:29 2005
@@ -16,6 +16,8 @@
 - Fixed bug #32813 (parse_url() does not handle scheme-only urls properly). 
(Ilia)
 - Fixed bug #32802 (General cookie overrides more specific cookie). (Ilia)
 - Fixed bugs #32800, #32830 (ext/odbc: Problems with 64bit systems). (Jani)
+- Fixed bug #32742 (segmentation fault when the stream with a wrapper 
+  is not closed). (Tony, Dmitry)
 - Fixed bug #32730 (ext/crack.c fails to compile with cracklib-2.8.3). (Jani)
 - Fixed bug #32670 (foreach() does not issue warning on unset array arg). 
(Ilia)
 - Fixed bug #32699 (pg_affected_rows() was defined when it was not available).
http://cvs.php.net/diff.php/php-src/ext/standard/basic_functions.c?r1=1.543.2.50&r2=1.543.2.51&ty=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.543.2.50 
php-src/ext/standard/basic_functions.c:1.543.2.51
--- php-src/ext/standard/basic_functions.c:1.543.2.50   Mon May  9 03:08:42 2005
+++ php-src/ext/standard/basic_functions.c      Mon May 16 04:55:31 2005
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.543.2.50 2005/05/09 07:08:42 sniper Exp $ */
+/* $Id: basic_functions.c,v 1.543.2.51 2005/05/16 08:55:31 tony2001 Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -1239,11 +1239,10 @@
        }
        STR_FREE(BG(locale_string));
 
-       if (FG(stream_wrappers)) {
-               zend_hash_destroy(FG(stream_wrappers));
-               efree(FG(stream_wrappers));
-               FG(stream_wrappers) = NULL;
-       }
+       /*
+        FG(stream_wrappers) are destroyed
+        during php_request_shutdown()
+        */
 
        PHP_RSHUTDOWN(fsock) (SHUTDOWN_FUNC_ARGS_PASSTHRU);
        PHP_RSHUTDOWN(filestat) (SHUTDOWN_FUNC_ARGS_PASSTHRU);
http://cvs.php.net/diff.php/php-src/main/main.c?r1=1.512.2.62&r2=1.512.2.63&ty=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.512.2.62 php-src/main/main.c:1.512.2.63
--- php-src/main/main.c:1.512.2.62      Wed Apr 27 17:22:18 2005
+++ php-src/main/main.c Mon May 16 04:55:31 2005
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: main.c,v 1.512.2.62 2005/04/27 21:22:18 andrey Exp $ */
+/* $Id: main.c,v 1.512.2.63 2005/05/16 08:55:31 tony2001 Exp $ */
 
 /* {{{ includes
  */
@@ -1000,6 +1000,10 @@
                sapi_deactivate(TSRMLS_C);
        } zend_end_try();
 
+       zend_try {
+               php_shutdown_stream_hashes(TSRMLS_C);
+       } zend_end_try();
+
        zend_try { 
                shutdown_memory_manager(CG(unclean_shutdown), 0 TSRMLS_CC);
        } zend_end_try();
http://cvs.php.net/diff.php/php-src/main/php_streams.h?r1=1.61.2.17&r2=1.61.2.18&ty=u
Index: php-src/main/php_streams.h
diff -u php-src/main/php_streams.h:1.61.2.17 
php-src/main/php_streams.h:1.61.2.18
--- php-src/main/php_streams.h:1.61.2.17        Mon Jun 21 15:33:48 2004
+++ php-src/main/php_streams.h  Mon May 16 04:55:31 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_streams.h,v 1.61.2.17 2004/06/21 19:33:48 pollita Exp $ */
+/* $Id: php_streams.h,v 1.61.2.18 2005/05/16 08:55:31 tony2001 Exp $ */
 
 #ifndef PHP_STREAMS_H
 #define PHP_STREAMS_H
@@ -526,6 +526,7 @@
 
 int php_init_stream_wrappers(int module_number TSRMLS_DC);
 int php_shutdown_stream_wrappers(int module_number TSRMLS_DC);
+void php_shutdown_stream_hashes(TSRMLS_D);
 PHP_RSHUTDOWN_FUNCTION(streams);
 
 PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper 
*wrapper TSRMLS_DC);
http://cvs.php.net/diff.php/php-src/main/streams.c?r1=1.125.2.95&r2=1.125.2.96&ty=u
Index: php-src/main/streams.c
diff -u php-src/main/streams.c:1.125.2.95 php-src/main/streams.c:1.125.2.96
--- php-src/main/streams.c:1.125.2.95   Thu Apr  7 03:28:08 2005
+++ php-src/main/streams.c      Mon May 16 04:55:31 2005
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: streams.c,v 1.125.2.95 2005/04/07 07:28:08 thetaphi Exp $ */
+/* $Id: streams.c,v 1.125.2.96 2005/05/16 08:55:31 tony2001 Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -2330,6 +2330,15 @@
        FG(pclose_ret) = php_stream_free(stream, PHP_STREAM_FREE_CLOSE | 
PHP_STREAM_FREE_RSRC_DTOR);
 }
 
+void php_shutdown_stream_hashes(TSRMLS_D)
+{
+       if (FG(stream_wrappers)) {
+               zend_hash_destroy(FG(stream_wrappers));
+               efree(FG(stream_wrappers));
+               FG(stream_wrappers) = NULL;
+       }
+}
+
 int php_init_stream_wrappers(int module_number TSRMLS_DC)
 {
        le_stream = 
zend_register_list_destructors_ex(stream_resource_regular_dtor, NULL, "stream", 
module_number);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to