cvs: php-src /ext/filter filter.c
| From: | Ilia Alshanetsky | Date: | Thu, 27 Jul 2006 18:15:10 +0000 |
| Subject: | cvs: php-src /ext/filter filter.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-39598@lists.php.net to get a copy of this message | ||
iliaa Thu Jul 27 18:15:10 2006 UTC
Modified files:
/php-src/ext/filter filter.c
Log:
MFB: 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.60&r2=1.61&diff_format=u
Index: php-src/ext/filter/filter.c
diff -u php-src/ext/filter/filter.c:1.60 php-src/ext/filter/filter.c:1.61
--- php-src/ext/filter/filter.c:1.60 Tue Jul 25 10:36:11 2006
+++ php-src/ext/filter/filter.c Thu Jul 27 18:15:10 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filter.c,v 1.60 2006/07/25 10:36:11 tony2001 Exp $ */
+/* $Id: filter.c,v 1.61 2006/07/27 18:15:10 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.60 $");
+ php_info_print_table_row( 2, "Revision", "$Revision: 1.61 $");
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) {