@@ -166,129 +166,6 @@ static const php_stream_filter_factory strfilter_tolower_factory = {
166166};
167167/* }}} */
168168
169- /* {{{ strip_tags filter implementation */
170- typedef struct _php_strip_tags_filter {
171- const char * allowed_tags ;
172- int allowed_tags_len ;
173- uint8_t state ;
174- uint8_t persistent ;
175- } php_strip_tags_filter ;
176-
177- static int php_strip_tags_filter_ctor (php_strip_tags_filter * inst , zend_string * allowed_tags , int persistent )
178- {
179- if (allowed_tags != NULL ) {
180- if (NULL == (inst -> allowed_tags = pemalloc (ZSTR_LEN (allowed_tags ) + 1 , persistent ))) {
181- return FAILURE ;
182- }
183- memcpy ((char * )inst -> allowed_tags , ZSTR_VAL (allowed_tags ), ZSTR_LEN (allowed_tags ) + 1 );
184- inst -> allowed_tags_len = (int )ZSTR_LEN (allowed_tags );
185- } else {
186- inst -> allowed_tags = NULL ;
187- }
188- inst -> state = 0 ;
189- inst -> persistent = persistent ;
190-
191- return SUCCESS ;
192- }
193-
194- static void php_strip_tags_filter_dtor (php_strip_tags_filter * inst )
195- {
196- if (inst -> allowed_tags != NULL ) {
197- pefree ((void * )inst -> allowed_tags , inst -> persistent );
198- }
199- }
200-
201- static php_stream_filter_status_t strfilter_strip_tags_filter (
202- php_stream * stream ,
203- php_stream_filter * thisfilter ,
204- php_stream_bucket_brigade * buckets_in ,
205- php_stream_bucket_brigade * buckets_out ,
206- size_t * bytes_consumed ,
207- int flags
208- )
209- {
210- php_stream_bucket * bucket ;
211- size_t consumed = 0 ;
212- php_strip_tags_filter * inst = (php_strip_tags_filter * ) Z_PTR (thisfilter -> abstract );
213-
214- while (buckets_in -> head ) {
215- bucket = php_stream_bucket_make_writeable (buckets_in -> head );
216- consumed = bucket -> buflen ;
217-
218- bucket -> buflen = php_strip_tags (bucket -> buf , bucket -> buflen , & (inst -> state ), inst -> allowed_tags , inst -> allowed_tags_len );
219-
220- php_stream_bucket_append (buckets_out , bucket );
221- }
222-
223- if (bytes_consumed ) {
224- * bytes_consumed = consumed ;
225- }
226-
227- return PSFS_PASS_ON ;
228- }
229-
230- static void strfilter_strip_tags_dtor (php_stream_filter * thisfilter )
231- {
232- assert (Z_PTR (thisfilter -> abstract ) != NULL );
233-
234- php_strip_tags_filter_dtor ((php_strip_tags_filter * )Z_PTR (thisfilter -> abstract ));
235-
236- pefree (Z_PTR (thisfilter -> abstract ), ((php_strip_tags_filter * )Z_PTR (thisfilter -> abstract ))-> persistent );
237- }
238-
239- static const php_stream_filter_ops strfilter_strip_tags_ops = {
240- strfilter_strip_tags_filter ,
241- strfilter_strip_tags_dtor ,
242- "string.strip_tags"
243- };
244-
245- static php_stream_filter * strfilter_strip_tags_create (const char * filtername , zval * filterparams , uint8_t persistent )
246- {
247- php_strip_tags_filter * inst ;
248- php_stream_filter * filter = NULL ;
249- zend_string * allowed_tags = NULL ;
250-
251- php_error_docref (NULL , E_DEPRECATED , "The string.strip_tags filter is deprecated" );
252-
253- inst = pemalloc (sizeof (php_strip_tags_filter ), persistent );
254-
255- if (filterparams != NULL ) {
256- if (Z_TYPE_P (filterparams ) == IS_ARRAY ) {
257- smart_str tags_ss = {0 };
258- zval * tmp ;
259-
260- ZEND_HASH_FOREACH_VAL (Z_ARRVAL_P (filterparams ), tmp ) {
261- convert_to_string_ex (tmp );
262- smart_str_appendc (& tags_ss , '<' );
263- smart_str_append (& tags_ss , Z_STR_P (tmp ));
264- smart_str_appendc (& tags_ss , '>' );
265- } ZEND_HASH_FOREACH_END ();
266- smart_str_0 (& tags_ss );
267- allowed_tags = tags_ss .s ;
268- } else {
269- allowed_tags = zval_get_string (filterparams );
270- }
271- }
272-
273- if (php_strip_tags_filter_ctor (inst , allowed_tags , persistent ) == SUCCESS ) {
274- filter = php_stream_filter_alloc (& strfilter_strip_tags_ops , inst , persistent );
275- } else {
276- pefree (inst , persistent );
277- }
278-
279- if (allowed_tags ) {
280- zend_string_release (allowed_tags );
281- }
282-
283- return filter ;
284- }
285-
286- static const php_stream_filter_factory strfilter_strip_tags_factory = {
287- strfilter_strip_tags_create
288- };
289-
290- /* }}} */
291-
292169/* {{{ base64 / quoted_printable stream filter implementation */
293170
294171typedef enum _php_conv_err_t {
@@ -2037,7 +1914,6 @@ static const struct {
20371914 { & strfilter_rot13_ops , & strfilter_rot13_factory },
20381915 { & strfilter_toupper_ops , & strfilter_toupper_factory },
20391916 { & strfilter_tolower_ops , & strfilter_tolower_factory },
2040- { & strfilter_strip_tags_ops , & strfilter_strip_tags_factory },
20411917 { & strfilter_convert_ops , & strfilter_convert_factory },
20421918 { & consumed_filter_ops , & consumed_filter_factory },
20431919 { & chunked_filter_ops , & chunked_filter_factory },
0 commit comments