Re: cvs: php-src /ext/filter filter.c

From: Date: Tue, 12 Sep 2006 12:57:19 +0000
Subject: Re: cvs: php-src /ext/filter filter.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-40460@lists.php.net to get a copy of this message
On Thu, 31 Aug 2006, Antony Dovgal wrote: > tony2001 Thu Aug 31 22:11:35 2006 UTC > > Modified files: > /php-src/ext/filter filter.c > Log: > change filters to operate on the copy of data, so multiple filters an be applied one after > another It was this patch that broke the default filter for the request parameters. Didn't manage to figure out yet how to best fix it though. regards, Derick > > http://cvs.php.net/viewvc.cgi/php-src/ext/filter/filter.c?r1=1.65&r2=1.66&diff_format=u •&?ŒÐáM > I‰Ê6¶’ > Index: php-src/ext/filter/filter.c > diff -u php-src/ext/filter/filter.c:1.65 php-src/ext/filter/filter.c:1.66 > --- php-src/ext/filter/filter.c:1.65 Thu Aug 31 15:17:08 2006 > +++ php-src/ext/filter/filter.c Thu Aug 31 22:11:35 2006 > @@ -18,7 +18,7 @@ > +----------------------------------------------------------------------+ > */ > > -/* $Id: filter.c,v 1.65 2006/08/31 15:17:08 tony2001 Exp $ */ > +/* $Id: filter.c,v 1.66 2006/08/31 22:11:35 tony2001 Exp $ */ > > #ifdef HAVE_CONFIG_H > #include "config.h" > @@ -274,7 +274,7 @@ > { > php_info_print_table_start(); > php_info_print_table_row( 2, "Input Validation and Filtering", "enabled" > ); > - php_info_print_table_row( 2, "Revision", "$Revision: 1.65 $"); > + php_info_print_table_row( 2, "Revision", "$Revision: 1.66 $"); > php_info_print_table_end(); > > DISPLAY_INI_ENTRIES(); > @@ -301,7 +301,7 @@ > } > /* }}} */ > > -static void php_zval_filter(zval *value, long filter, long flags, zval *options, char* charset > TSRMLS_DC) /* {{{ */ > +static void php_zval_filter(zval **value, long filter, long flags, zval *options, char* > charset TSRMLS_DC) /* {{{ */ > { > filter_list_entry filter_func; > > @@ -312,10 +312,11 @@ > filter_func = php_find_filter(FILTER_DEFAULT); > } > > + SEPARATE_ZVAL(value); > /* Here be strings */ > - convert_to_string(value); > + convert_to_string(*value); > > - filter_func.function(value, flags, options, charset TSRMLS_CC); > + filter_func.function(*value, flags, options, charset TSRMLS_CC); > } > /* }}} */ > > @@ -376,8 +377,10 @@ > Z_TYPE(new_var) = IS_STRING; > > if (!(IF_G(default_filter) == FILTER_UNSAFE_RAW)) { > + zval *tmp_new_var = &new_var; > Z_STRVAL(new_var) = estrndup(*val, val_len); > - php_zval_filter(&new_var, IF_G(default_filter), IF_G(default_filter_flags), NULL, > NULL/*charset*/ TSRMLS_CC); > + INIT_PZVAL(tmp_new_var); > + php_zval_filter(&tmp_new_var, IF_G(default_filter), IF_G(default_filter_flags), NULL, > NULL/*charset*/ TSRMLS_CC); > } > #if PHP_VERSION_ID<60000 > else if (PG(magic_quotes_gpc)) { > @@ -415,16 +418,16 @@ > } > /* }}} */ > > -static void php_zval_filter_recursive(zval *value, long filter, long flags, zval *options, > char *charset TSRMLS_DC) /* {{{ */ > +static void php_zval_filter_recursive(zval **value, long filter, long flags, zval *options, > char *charset TSRMLS_DC) /* {{{ */ > { > zval **element; > HashPosition pos; > > - if (Z_TYPE_P(value) == IS_ARRAY) { > - for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(value), &pos); > - zend_hash_get_current_data_ex(Z_ARRVAL_P(value), (void **) &element, &pos) == > SUCCESS; > - zend_hash_move_forward_ex(Z_ARRVAL_P(value), &pos)) { > - php_zval_filter_recursive(*element, filter, flags, options, charset TSRMLS_CC); > + if (Z_TYPE_PP(value) == IS_ARRAY) { > + for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(value), &pos); > + zend_hash_get_current_data_ex(Z_ARRVAL_PP(value), (void **) &element, &pos) == > SUCCESS; > + zend_hash_move_forward_ex(Z_ARRVAL_PP(value), &pos)) { > + php_zval_filter_recursive(element, filter, flags, options, charset TSRMLS_CC); > } > } else { > php_zval_filter(value, filter, flags, options, charset TSRMLS_CC); > @@ -632,7 +635,7 @@ > > if (found) { > zval_copy_ctor(return_value); /* Watch out for empty strings */ > - php_zval_filter_recursive(return_value, filter, filter_flags, options, charset TSRMLS_CC); > + php_zval_filter_recursive(&return_value, filter, filter_flags, options, charset > TSRMLS_CC); > } else { > RETURN_NULL(); > } > @@ -779,7 +782,7 @@ > } > > if (filter_flags & FILTER_FLAG_ARRAY) { > - php_zval_filter_recursive(*tmp, filter, filter_flags, options, charset TSRMLS_CC); > + php_zval_filter_recursive(tmp, filter, filter_flags, options, charset TSRMLS_CC); > > /* ARRAY always returns an array */ > if (Z_TYPE_PP(tmp) != IS_ARRAY) { > @@ -789,7 +792,7 @@ > *tmp = temparray; > } > } else { > - php_zval_filter(*tmp, filter, filter_flags, options, charset TSRMLS_CC); > + php_zval_filter(tmp, filter, filter_flags, options, charset TSRMLS_CC); > } > zval_add_ref(tmp); > add_assoc_zval(return_value, key, *tmp); > @@ -883,7 +886,7 @@ > } > } > } > - php_zval_filter_recursive(var, filter, filter_flags, options, charset TSRMLS_CC); > + php_zval_filter_recursive(&var, filter, filter_flags, options, charset TSRMLS_CC); > RETURN_ZVAL(var, 1, 0); > } > /* }}} */ > > -- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

« previous php.cvs (#40460) next »