iliaa Thu Jul 27 18:14:55 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/filter filter.c /php-src NEWS Log: Fixed a bug in the filter extension that prevented magic_quotes_gpc from being applied when RAW filter is used. http://cvs.php.net/viewvc.cgi/php-src/ext/filter/filter.c?r1=1.52.2.8&r2=1.52.2.9&diff_format=u Index: php-src/ext/filter/filter.c diff -u php-src/ext/filter/filter.c:1.52.2.8 php-src/ext/filter/filter.c:1.52.2.9 --- php-src/ext/filter/filter.c:1.52.2.8 Tue Jul 25 10:36:19 2006 +++ php-src/ext/filter/filter.c Thu Jul 27 18:14:55 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: filter.c,v 1.52.2.8 2006/07/25 10:36:19 tony2001 Exp $ */ +/* $Id: filter.c,v 1.52.2.9 2006/07/27 18:14:55 iliaa 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.52.2.8 $"); + php_info_print_table_row( 2, "Revision", "$Revision: 1.52.2.9 $"); php_info_print_table_end(); DISPLAY_INI_ENTRIES(); @@ -368,17 +368,23 @@ php_register_variable_ex(var, &raw_var, array_ptr TSRMLS_CC); } - /* Register mangled variable */ - /* FIXME: Should not use php_register_variable_ex as that also registers - * globals when register_globals is turned on */ - Z_STRLEN(new_var) = val_len; - Z_STRVAL(new_var) = estrndup(*val, val_len + 1); - Z_TYPE(new_var) = IS_STRING; - if (val_len) { - if (! (IF_G(default_filter) == FILTER_UNSAFE_RAW)) { + /* Register mangled variable */ + /* FIXME: Should not use php_register_variable_ex as that also registers + * globals when register_globals is turned on */ + Z_STRLEN(new_var) = val_len; + Z_TYPE(new_var) = IS_STRING; + + if (!(IF_G(default_filter) == FILTER_UNSAFE_RAW)) { + Z_STRVAL(new_var) = estrndup(*val, val_len + 1); php_zval_filter(&new_var, IF_G(default_filter), IF_G(default_filter_flags), NULL, NULL/*charset*/ TSRMLS_CC); + } else if (PG(magic_quotes_gpc)) { + Z_STRVAL(new_var) = php_addslashes(*val, Z_STRLEN(new_var), &Z_STRLEN(new_var), 0 TSRMLS_CC); + } else { + Z_STRVAL(new_var) = estrndup(*val, val_len + 1); } + } else { /* empty string */ + ZVAL_EMPTY_STRING(&new_var); } if (orig_array_ptr) { http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.158&r2=1.2027.2.547.2.159&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.158 php-src/NEWS:1.2027.2.547.2.159 --- php-src/NEWS:1.2027.2.547.2.158 Thu Jul 27 15:37:56 2006 +++ php-src/NEWS Thu Jul 27 18:14:55 2006 @@ -15,6 +15,8 @@ . Fixed bug #37564 (AES privacy encryption not possible due to net-snmp 5.2 compatibility issue). (Patch: scott dot moynes+php at gmail dot com) +- Fixed a bug in the filter extension that prevented magic_quotes_gpc from + being applied when RAW filter is used. (Ilia) - Fixed bug #38236 (Binary data gets corrupted on multipart/formdata POST). (Ilia) - Fixed bug #38234 (Exception in __clone makes memory leak). (Dmitry, Nuno)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php