tony2001                Mon May 16 04:37:42 2005 EDT

  Modified files:              (Branch: PHP_5_0)
    /php-src    NEWS 
    /php-src/main       main.c php_streams.h 
    /php-src/main/streams       streams.c 
    /php-src/ext/standard       basic_functions.c 
  Log:
  MFH: fix bugs #32742 (segmentation fault when the stream with a wrapper 
  is not closed), #32171 (Userspace stream wrapper crashes PHP)
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1760.2.384&r2=1.1760.2.385&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1760.2.384 php-src/NEWS:1.1760.2.385
--- php-src/NEWS:1.1760.2.384   Fri May 13 19:15:33 2005
+++ php-src/NEWS        Mon May 16 04:37:40 2005
@@ -32,6 +32,8 @@
 - Fixed bug #32755 (Segfault in replaceChild() when DocumentFragment has
   no children). (Rob)
 - Fixed bug #32753 (Undefined constant SQLITE_NOTADB). (Ilia)
+- Fixed bug #32742 (segmentation fault when the stream with a wrapper 
+  is not closed). (Tony, Dmitry)
 - Fixed bug #32699 (pg_affected_rows() was defined when it was not available).
   (Derick)
 - Fixed bug #32686 (Require/include file in destructor causes segfault).
@@ -65,6 +67,7 @@
   5.0.3). (Dmitry)
 - Fixed bug #32245 (xml_parser_free() in a function assigned to the xml parser
   gives a segfault). (Rob)
+- Fixed bug #32171 (Userspace stream wrapper crashes PHP). (Tony, Dmitry)
 - Fixed bug #32080 (segfault when assigning object to itself with
   zend.ze1_compatibility_mode=On). (Dmitry)
 - Fixed bug #32013 (ext/mysqli bind_result causes fatal error: memory
http://cvs.php.net/diff.php/php-src/main/main.c?r1=1.604.2.14&r2=1.604.2.15&ty=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.604.2.14 php-src/main/main.c:1.604.2.15
--- php-src/main/main.c:1.604.2.14      Wed Apr 27 17:23:44 2005
+++ php-src/main/main.c Mon May 16 04:37:41 2005
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: main.c,v 1.604.2.14 2005/04/27 21:23:44 andrey Exp $ */
+/* $Id: main.c,v 1.604.2.15 2005/05/16 08:37:41 tony2001 Exp $ */
 
 /* {{{ includes
  */
@@ -1162,6 +1162,10 @@
        } 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();
 
@@ -1228,6 +1232,10 @@
        } zend_end_try();
 
        zend_try {
+               php_shutdown_stream_hashes(TSRMLS_C);
+       } zend_end_try();
+
+       zend_try {
                shutdown_memory_manager(CG(unclean_shutdown) || 
!report_memleaks, 0 TSRMLS_CC);
        } zend_end_try();
 
http://cvs.php.net/diff.php/php-src/main/php_streams.h?r1=1.95.2.3&r2=1.95.2.4&ty=u
Index: php-src/main/php_streams.h
diff -u php-src/main/php_streams.h:1.95.2.3 php-src/main/php_streams.h:1.95.2.4
--- php-src/main/php_streams.h:1.95.2.3 Wed Apr  6 10:47:51 2005
+++ php-src/main/php_streams.h  Mon May 16 04:37:41 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_streams.h,v 1.95.2.3 2005/04/06 14:47:51 iliaa Exp $ */
+/* $Id: php_streams.h,v 1.95.2.4 2005/05/16 08:37:41 tony2001 Exp $ */
 
 #ifndef PHP_STREAMS_H
 #define PHP_STREAMS_H
@@ -505,6 +505,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);
 
 BEGIN_EXTERN_C()
http://cvs.php.net/diff.php/php-src/main/streams/streams.c?r1=1.61.2.10&r2=1.61.2.11&ty=u
Index: php-src/main/streams/streams.c
diff -u php-src/main/streams/streams.c:1.61.2.10 
php-src/main/streams/streams.c:1.61.2.11
--- php-src/main/streams/streams.c:1.61.2.10    Mon Apr 11 11:19:40 2005
+++ php-src/main/streams/streams.c      Mon May 16 04:37:41 2005
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: streams.c,v 1.61.2.10 2005/04/11 15:19:40 tony2001 Exp $ */
+/* $Id: streams.c,v 1.61.2.11 2005/05/16 08:37:41 tony2001 Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -1367,6 +1367,21 @@
        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;
+       }
+
+       if (FG(stream_filters)) {
+               zend_hash_destroy(FG(stream_filters));
+               efree(FG(stream_filters));
+               FG(stream_filters) = 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);
http://cvs.php.net/diff.php/php-src/ext/standard/basic_functions.c?r1=1.673.2.16&r2=1.673.2.17&ty=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.673.2.16 
php-src/ext/standard/basic_functions.c:1.673.2.17
--- php-src/ext/standard/basic_functions.c:1.673.2.16   Wed Apr 27 11:44:06 2005
+++ php-src/ext/standard/basic_functions.c      Mon May 16 04:37:41 2005
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.673.2.16 2005/04/27 15:44:06 dmitry Exp $ */
+/* $Id: basic_functions.c,v 1.673.2.17 2005/05/16 08:37:41 tony2001 Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -1191,17 +1191,10 @@
        }
        STR_FREE(BG(locale_string));
 
-       if (FG(stream_wrappers)) {
-               zend_hash_destroy(FG(stream_wrappers));
-               efree(FG(stream_wrappers));
-               FG(stream_wrappers) = NULL;
-       }
-
-       if (FG(stream_filters)) {
-               zend_hash_destroy(FG(stream_filters));
-               efree(FG(stream_filters));
-               FG(stream_filters) = NULL;
-       }
+       /*
+        FG(stream_wrappers) and FG(stream_filters) are destroyed
+        during php_request_shutdown()
+        */
 
        PHP_RSHUTDOWN(filestat)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
 #ifdef HAVE_SYSLOG_H

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

Reply via email to