28
28
#define PHP_STREAM_BRIGADE_RES_NAME "userfilter.bucket brigade"
29
29
#define PHP_STREAM_BUCKET_RES_NAME "userfilter.bucket"
30
30
#define PHP_STREAM_FILTER_RES_NAME "userfilter.filter"
31
- #define PHP_STREAM_RES_NAME "userfilter.stream"
32
31
33
32
struct php_user_filter_data {
34
33
zend_class_entry * ce ;
@@ -40,7 +39,6 @@ struct php_user_filter_data {
40
39
static int le_userfilters ;
41
40
static int le_bucket_brigade ;
42
41
static int le_bucket ;
43
- static int le_stream ;
44
42
45
43
#define GET_FILTER_FROM_OBJ () { \
46
44
zval **tmp; \
@@ -82,9 +80,10 @@ PHP_MINIT_FUNCTION(user_filters)
82
80
return FAILURE ;
83
81
}
84
82
83
+ /* Filters will dispose of their brigades */
85
84
le_bucket_brigade = zend_register_list_destructors_ex (NULL , NULL , PHP_STREAM_BRIGADE_RES_NAME , module_number );
85
+ /* Brigades will dispose of their buckets */
86
86
le_bucket = zend_register_list_destructors_ex (NULL , NULL , PHP_STREAM_BUCKET_RES_NAME , module_number );
87
- le_stream = zend_register_list_destructors_ex (NULL , NULL , PHP_STREAM_RES_NAME , module_number );
88
87
89
88
if (le_bucket_brigade == FAILURE ) {
90
89
return FAILURE ;
@@ -149,7 +148,7 @@ php_stream_filter_status_t userfilter_filter(
149
148
if (FAILURE == zend_hash_find (Z_OBJPROP_P (obj ), "stream" , sizeof ("stream" ), (void * * )& zstream )) {
150
149
/* Give the userfilter class a hook back to the stream */
151
150
ALLOC_INIT_ZVAL (zstream );
152
- ZEND_REGISTER_RESOURCE ( zstream , stream , le_stream );
151
+ php_stream_to_zval ( stream , zstream );
153
152
add_property_zval (obj , "stream" , zstream );
154
153
/* add_property_zval increments the refcount which is unwanted here */
155
154
zval_ptr_dtor (& zstream );
@@ -402,7 +401,7 @@ PHP_FUNCTION(stream_bucket_new)
402
401
RETURN_FALSE ;
403
402
}
404
403
405
- ZEND_FETCH_RESOURCE (stream , php_stream * , & zstream , -1 , PHP_STREAM_RES_NAME , le_stream );
404
+ php_stream_from_zval (stream , & zstream );
406
405
407
406
if (!(pbuffer = pemalloc (buffer_len , php_stream_is_persistent (stream )))) {
408
407
RETURN_FALSE ;
0 commit comments