@@ -147,13 +147,10 @@ php_stream_filter_status_t userfilter_filter(
147147 uint32_t orig_no_fclose = stream -> flags & PHP_STREAM_FLAG_NO_FCLOSE ;
148148 stream -> flags |= PHP_STREAM_FLAG_NO_FCLOSE ;
149149
150- zval * stream_prop = zend_hash_str_find_ind (Z_OBJPROP_P (obj ), "stream" , sizeof ("stream" )- 1 );
151- if (stream_prop ) {
152- /* Give the userfilter class a hook back to the stream */
153- zval_ptr_dtor (stream_prop );
154- php_stream_to_zval (stream , stream_prop );
155- Z_ADDREF_P (stream_prop );
156- }
150+ /* Give the userfilter class a hook back to the stream */
151+ zval stream_zval ;
152+ php_stream_to_zval (stream , & stream_zval );
153+ zend_update_property (Z_OBJCE_P (obj ), Z_OBJ_P (obj ), "stream" , sizeof ("stream" )- 1 , & stream_zval );
157154
158155 ZVAL_STRINGL (& func_name , "filter" , sizeof ("filter" )- 1 );
159156
@@ -196,9 +193,7 @@ php_stream_filter_status_t userfilter_filter(
196193 /* filter resources are cleaned up by the stream destructor,
197194 * keeping a reference to the stream resource here would prevent it
198195 * from being destroyed properly */
199- if (stream_prop ) {
200- convert_to_null (stream_prop );
201- }
196+ zend_update_property_null (Z_OBJCE_P (obj ), Z_OBJ_P (obj ), "stream" , sizeof ("stream" )- 1 );
202197
203198 zval_ptr_dtor (& args [3 ]);
204199 zval_ptr_dtor (& args [2 ]);
0 commit comments