summaryrefslogtreecommitdiff
path: root/README.input_filter
diff options
context:
space:
mode:
authorRasmus Lerdorf <rasmus@php.net>2003-02-20 22:21:49 (GMT)
committerRasmus Lerdorf <rasmus@php.net>2003-02-20 22:21:49 (GMT)
commitd08a0e99c865509214c9a577babc9499f6d377b3 (patch)
treedf78b262b07c5ec8593ea0747903737aecb5c572 /README.input_filter
parent9d89ef32956e1e5593d22232a5a0eaa5015343c1 (diff)
downloadphp-d08a0e99c865509214c9a577babc9499f6d377b3.tar.gz
An input filter might not simply strip stuff, it might also turn things
into entities or use some other mechanism which causes the filtered data to be longer than the original data. Ergo, pass in the address of the buffer instead so the filter is free to reallocate it.
Diffstat (limited to 'README.input_filter')
-rw-r--r--README.input_filter10
1 files changed, 5 insertions, 5 deletions
diff --git a/README.input_filter b/README.input_filter
index 011b167..60a88ed 100644
--- a/README.input_filter
+++ b/README.input_filter
@@ -89,14 +89,14 @@ PHP_MINFO_FUNCTION(my_input_filter)
php_info_print_table_end();
}
-unsigned int my_sapi_input_filter(int arg, char *var, char *val, unsigned int val_len)
+unsigned int my_sapi_input_filter(int arg, char *var, char **val, unsigned int val_len)
{
zval new_var;
zval *array_ptr = NULL;
char *raw_var;
int var_len;
- assert(val != NULL);
+ assert(*val != NULL);
switch(arg) {
case PARSE_GET:
@@ -125,7 +125,7 @@ unsigned int my_sapi_input_filter(int arg, char *var, char *val, unsigned int v
break;
}
Z_STRLEN(new_var) = val_len;
- Z_STRVAL(new_var) = estrndup(val, val_len);
+ Z_STRVAL(new_var) = estrndup(*val, val_len);
Z_TYPE(new_var) = IS_STRING;
var_len = strlen(var);
@@ -135,9 +135,9 @@ unsigned int my_sapi_input_filter(int arg, char *var, char *val, unsigned int v
php_register_variable_ex(raw_var, &new_var, array_ptr TSRMLS_DC);
- php_strip_tags(val, val_len, NULL, NULL, 0);
+ php_strip_tags(*val, val_len, NULL, NULL, 0);
- return strlen(val);
+ return strlen(*val);
}
PHP_FUNCTION(my_get_raw)