iliaa Tue Mar 28 16:01:04 2006 UTC
Modified files: (Branch: PHP_5_1)
/php-src/ext/standard user_filters.c
/php-src NEWS
Log:
Fixed bug #36886 (User filters can leak buckets in some situations).
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/user_filters.c?r1=1.31.2.2&r2=1.31.2.3&diff_format=u
Index: php-src/ext/standard/user_filters.c
diff -u php-src/ext/standard/user_filters.c:1.31.2.2
php-src/ext/standard/user_filters.c:1.31.2.3
--- php-src/ext/standard/user_filters.c:1.31.2.2 Sun Feb 26 10:49:51 2006
+++ php-src/ext/standard/user_filters.c Tue Mar 28 16:01:04 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: user_filters.c,v 1.31.2.2 2006/02/26 10:49:51 helly Exp $ */
+/* $Id: user_filters.c,v 1.31.2.3 2006/03/28 16:01:04 iliaa Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -64,6 +64,15 @@
static zend_class_entry user_filter_class_entry;
+static ZEND_RSRC_DTOR_FUNC(php_bucket_dtor)
+{
+ php_stream_bucket *bucket = (struct php_stream_bucket *)rsrc->ptr;
+ if (bucket) {
+ php_stream_bucket_delref(bucket TSRMLS_CC);
+ bucket = NULL;
+ }
+}
+
PHP_MINIT_FUNCTION(user_filters)
{
/* init the filter class ancestor */
@@ -83,7 +92,7 @@
/* Filters will dispose of their brigades */
le_bucket_brigade = zend_register_list_destructors_ex(NULL, NULL,
PHP_STREAM_BRIGADE_RES_NAME, module_number);
/* Brigades will dispose of their buckets */
- le_bucket = zend_register_list_destructors_ex(NULL, NULL,
PHP_STREAM_BUCKET_RES_NAME, module_number);
+ le_bucket = zend_register_list_destructors_ex(php_bucket_dtor, NULL,
PHP_STREAM_BUCKET_RES_NAME, module_number);
if (le_bucket_brigade == FAILURE) {
return FAILURE;
@@ -418,6 +427,12 @@
} else {
php_stream_bucket_prepend(brigade, bucket TSRMLS_CC);
}
+ /* This is a hack necessary to accomodate situations where bucket is
appended to the stream
+ * multiple times. See bug35916.phpt for reference.
+ */
+ if (bucket->refcount == 1) {
+ bucket->refcount++;
+ }
}
/* }}} */
http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.486&r2=1.2027.2.487&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.486 php-src/NEWS:1.2027.2.487
--- php-src/NEWS:1.2027.2.486 Tue Mar 28 09:12:17 2006
+++ php-src/NEWS Tue Mar 28 16:01:04 2006
@@ -12,6 +12,7 @@
- Removed the E_STRICT deprecation notice from "var". (Ilia)
- Fixed debug_zval_dump() to support private and protected members. (Dmitry)
- Fixed SoapFault::getMessage(). (Dmitry)
+- Fixed bug #36886 (User filters can leak buckets in some situations). (Ilia)
- Fixed bug #36878 (error messages are printed even though an exception has
been thrown). (Tony)
- Fixed bug #36869 (memory leak in output buffering when using chunked output).
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php