stas            Tue Apr 28 21:30:23 2009 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/filter filter.c 
    /php-src/main       SAPI.c SAPI.h php_content_types.c 
  Log:
  fix for #47930
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/filter.c?r1=1.52.2.39.2.15&r2=1.52.2.39.2.16&diff_format=u
Index: php-src/ext/filter/filter.c
diff -u php-src/ext/filter/filter.c:1.52.2.39.2.15 
php-src/ext/filter/filter.c:1.52.2.39.2.16
--- php-src/ext/filter/filter.c:1.52.2.39.2.15  Tue Apr 14 14:18:35 2009
+++ php-src/ext/filter/filter.c Tue Apr 28 21:30:23 2009
@@ -19,7 +19,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: filter.c,v 1.52.2.39.2.15 2009/04/14 14:18:35 tony2001 Exp $ */
+/* $Id: filter.c,v 1.52.2.39.2.16 2009/04/28 21:30:23 stas Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -76,6 +76,7 @@
 #endif
 
 static unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned 
int val_len, unsigned int *new_val_len TSRMLS_DC);
+static unsigned int php_sapi_filter_init(TSRMLS_D);
 
 /* {{{ arginfo */
 ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_input, 0, 0, 2)
@@ -270,7 +271,7 @@
        REGISTER_LONG_CONSTANT("FILTER_FLAG_NO_RES_RANGE", 
FILTER_FLAG_NO_RES_RANGE, CONST_CS | CONST_PERSISTENT);
        REGISTER_LONG_CONSTANT("FILTER_FLAG_NO_PRIV_RANGE", 
FILTER_FLAG_NO_PRIV_RANGE, CONST_CS | CONST_PERSISTENT);
 
-       sapi_register_input_filter(php_sapi_filter);
+       sapi_register_input_filter(php_sapi_filter, php_sapi_filter_init);
 
        return SUCCESS;
 }
@@ -312,7 +313,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.39.2.15 $");
+       php_info_print_table_row( 2, "Revision", "$Revision: 1.52.2.39.2.16 $");
        php_info_print_table_end();
 
        DISPLAY_INI_ENTRIES();
@@ -339,6 +340,17 @@
 }
 /* }}} */
 
+static unsigned int php_sapi_filter_init(TSRMLS_D)
+{
+       IF_G(get_array) = NULL;
+       IF_G(post_array) = NULL;
+       IF_G(cookie_array) = NULL;
+       IF_G(server_array) = NULL;
+       IF_G(env_array) = NULL;
+       IF_G(session_array) = NULL;
+       return SUCCESS;
+}
+
 static void php_zval_filter(zval **value, long filter, long flags, zval 
*options, char* charset, zend_bool copy TSRMLS_DC) /* {{{ */
 {
        filter_list_entry  filter_func;
http://cvs.php.net/viewvc.cgi/php-src/main/SAPI.c?r1=1.202.2.7.2.15.2.6&r2=1.202.2.7.2.15.2.7&diff_format=u
Index: php-src/main/SAPI.c
diff -u php-src/main/SAPI.c:1.202.2.7.2.15.2.6 
php-src/main/SAPI.c:1.202.2.7.2.15.2.7
--- php-src/main/SAPI.c:1.202.2.7.2.15.2.6      Wed Dec 31 11:15:47 2008
+++ php-src/main/SAPI.c Tue Apr 28 21:30:23 2009
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: SAPI.c,v 1.202.2.7.2.15.2.6 2008/12/31 11:15:47 sebastian Exp $ */
+/* $Id: SAPI.c,v 1.202.2.7.2.15.2.7 2009/04/28 21:30:23 stas Exp $ */
 
 #include <ctype.h>
 #include <sys/stat.h>
@@ -326,6 +326,9 @@
                        sapi_module.activate(TSRMLS_C);
                }
        }
+       if (sapi_module.input_filter_init ) {
+               sapi_module.input_filter_init(TSRMLS_C);
+       }
 }
 
 /*
@@ -392,6 +395,9 @@
                        sapi_module.activate(TSRMLS_C);
                }
        }
+       if (sapi_module.input_filter_init ) {
+               sapi_module.input_filter_init(TSRMLS_C);
+       }
 }
 
 
@@ -925,13 +931,14 @@
        return SUCCESS;
 }
 
-SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, 
char *var, char **val, unsigned int val_len, unsigned int *new_val_len 
TSRMLS_DC))
+SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, 
char *var, char **val, unsigned int val_len, unsigned int *new_val_len 
TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D))
 {
        TSRMLS_FETCH();
        if (SG(sapi_started) && EG(in_execution)) {
                return FAILURE;
        }
        sapi_module.input_filter = input_filter;
+       sapi_module.input_filter_init = input_filter_init;
        return SUCCESS;
 }
 
http://cvs.php.net/viewvc.cgi/php-src/main/SAPI.h?r1=1.114.2.1.2.3.2.7&r2=1.114.2.1.2.3.2.8&diff_format=u
Index: php-src/main/SAPI.h
diff -u php-src/main/SAPI.h:1.114.2.1.2.3.2.7 
php-src/main/SAPI.h:1.114.2.1.2.3.2.8
--- php-src/main/SAPI.h:1.114.2.1.2.3.2.7       Wed Dec 31 17:33:05 2008
+++ php-src/main/SAPI.h Tue Apr 28 21:30:23 2009
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: SAPI.h,v 1.114.2.1.2.3.2.7 2008/12/31 17:33:05 helly Exp $ */
+/* $Id: SAPI.h,v 1.114.2.1.2.3.2.8 2009/04/28 21:30:23 stas Exp $ */
 
 #ifndef SAPI_H
 #define SAPI_H
@@ -192,7 +192,7 @@
 SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry 
TSRMLS_DC);
 SAPI_API int sapi_register_default_post_reader(void 
(*default_post_reader)(TSRMLS_D));
 SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, 
zval *destArray TSRMLS_DC));
-SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, 
char *var, char **val, unsigned int val_len, unsigned int *new_val_len 
TSRMLS_DC));
+SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, 
char *var, char **val, unsigned int val_len, unsigned int *new_val_len 
TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D));
 
 SAPI_API int sapi_flush(TSRMLS_D);
 SAPI_API struct stat *sapi_get_stat(TSRMLS_D);
@@ -266,6 +266,7 @@
 
        char *ini_entries;
        const zend_function_entry *additional_functions;
+       unsigned int (*input_filter_init)(TSRMLS_D);
 };
 
 
http://cvs.php.net/viewvc.cgi/php-src/main/php_content_types.c?r1=1.32.2.1.2.4.2.2&r2=1.32.2.1.2.4.2.3&diff_format=u
Index: php-src/main/php_content_types.c
diff -u php-src/main/php_content_types.c:1.32.2.1.2.4.2.2 
php-src/main/php_content_types.c:1.32.2.1.2.4.2.3
--- php-src/main/php_content_types.c:1.32.2.1.2.4.2.2   Wed Dec 31 11:15:47 2008
+++ php-src/main/php_content_types.c    Tue Apr 28 21:30:23 2009
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_content_types.c,v 1.32.2.1.2.4.2.2 2008/12/31 11:15:47 sebastian 
Exp $ */
+/* $Id: php_content_types.c,v 1.32.2.1.2.4.2.3 2009/04/28 21:30:23 stas Exp $ 
*/
 
 #include "php.h"
 #include "SAPI.h"
@@ -75,7 +75,7 @@
 {
        sapi_register_default_post_reader(php_default_post_reader);
        sapi_register_treat_data(php_default_treat_data);
-       sapi_register_input_filter(php_default_input_filter);
+       sapi_register_input_filter(php_default_input_filter, NULL);
        return SUCCESS;
 }
 /* }}} */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to