@@ -145,27 +145,20 @@ static const php_stream_ops php_stream_input_ops = {
145145 NULL /* set_option */
146146};
147147
148- static const char max_stream_filters = 5 ;
148+ static const char max_stream_filters = 16 ;
149149
150150static void php_stream_apply_filter_list (php_stream * stream , char * filterlist , int read_chain , int write_chain ) /* {{{ */
151151{
152152 char * p , * token = NULL ;
153153 php_stream_filter * temp_filter ;
154- char nb_filters = 0 ;
155154
156155 p = php_strtok_r (filterlist , "|" , & token );
157156 while (p ) {
158- if (nb_filters >= max_stream_filters ) {
159- zend_throw_exception_ex (NULL , 0 , "Unable to apply filter, maximum number (%d) reached" , max_stream_filters );
160- return ;
161- }
162- nb_filters ++ ;
163-
164157 php_url_decode (p , strlen (p ));
165158 if (read_chain ) {
166159 if ((temp_filter = php_stream_filter_create (p , NULL , php_stream_is_persistent (stream )))) {
167- if (php_stream_filter_count (& stream -> readfilters ) > max_stream_filters ) {
168- zend_throw_exception_ex ( NULL , 0 , "Unable to apply read filter, maximum number (%d) reached" , max_stream_filters );
160+ if (php_stream_filter_count (& stream -> readfilters ) >= max_stream_filters ) {
161+ zend_value_error ( "Unable to apply read filter, maximum number (%d) reached" , max_stream_filters );
169162 return ;
170163 }
171164 php_stream_filter_append (& stream -> readfilters , temp_filter );
@@ -175,8 +168,8 @@ static void php_stream_apply_filter_list(php_stream *stream, char *filterlist, i
175168 }
176169 if (write_chain ) {
177170 if ((temp_filter = php_stream_filter_create (p , NULL , php_stream_is_persistent (stream )))) {
178- if (php_stream_filter_count (& stream -> writefilters ) > max_stream_filters ) {
179- zend_throw_exception_ex ( NULL , 0 , "Unable to apply write filter, maximum number (%d) reached" , max_stream_filters );
171+ if (php_stream_filter_count (& stream -> writefilters ) >= max_stream_filters ) {
172+ zend_value_error ( "Unable to apply write filter, maximum number (%d) reached" , max_stream_filters );
180173 return ;
181174 }
182175 php_stream_filter_append (& stream -> writefilters , temp_filter );
0 commit comments