pajoye Sat Jul 22 09:51:50 2006 UTC
Modified files:
/php-src/ext/filter filter.c sanitizing_filters.c
/php-src/ext/filter/tests bug7733.phpt bug7586.phpt 032.phpt
Log:
MFB:
- API Shake up #1, change input_get_args argument order
- silent compiler warnings
- update tests
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/filter.c?r1=1.56&r2=1.57&diff_format=u
Index: php-src/ext/filter/filter.c
diff -u php-src/ext/filter/filter.c:1.56 php-src/ext/filter/filter.c:1.57
--- php-src/ext/filter/filter.c:1.56 Wed Jul 19 07:18:25 2006
+++ php-src/ext/filter/filter.c Sat Jul 22 09:51:50 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filter.c,v 1.56 2006/07/19 07:18:25 tony2001 Exp $ */
+/* $Id: filter.c,v 1.57 2006/07/22 09:51:50 pajoye 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.56 $");
+ php_info_print_table_row( 2, "Revision", "$Revision: 1.57 $");
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
@@ -629,8 +629,8 @@
}
/* }}} */
-/* {{{ proto mixed input_get_args(array definition, constant type [, array
data])
- * Returns an array with all arguments defined in 'definition'.
+/* {{{ proto mixed input_get_args(constant type, array definition, [, array
data])
+ * Returns an array with all arguments defined in 'definition'. INPUT_DATA
will use the data given as last argument.
*/
PHP_FUNCTION(input_get_args)
{
@@ -656,7 +656,7 @@
zval *array_ptr = NULL;
zval **element;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "al|a",
&args_array, &args_from, &values) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "la|a",
&args_from, &args_array, &values) == FAILURE) {
RETURN_FALSE;
}
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/sanitizing_filters.c?r1=1.12&r2=1.13&diff_format=u
Index: php-src/ext/filter/sanitizing_filters.c
diff -u php-src/ext/filter/sanitizing_filters.c:1.12
php-src/ext/filter/sanitizing_filters.c:1.13
--- php-src/ext/filter/sanitizing_filters.c:1.12 Wed Jul 19 06:56:28 2006
+++ php-src/ext/filter/sanitizing_filters.c Sat Jul 22 09:51:50 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sanitizing_filters.c,v 1.12 2006/07/19 06:56:28 tony2001 Exp $ */
+/* $Id: sanitizing_filters.c,v 1.13 2006/07/22 09:51:50 pajoye Exp $ */
#include "php_filter.h"
#include "filter_private.h"
@@ -58,7 +58,7 @@
register int x, y;
smart_str str = {0};
int len = Z_STRLEN_P(value);
- unsigned char *s = Z_STRVAL_P(value);
+ unsigned char *s = (unsigned char *)Z_STRVAL_P(value);
if (Z_STRLEN_P(value) == 0) {
return;
@@ -106,7 +106,7 @@
}
str[y] = '\0';
efree(Z_STRVAL_P(value));
- Z_STRVAL_P(value) = str;
+ Z_STRVAL_P(value) = (char *)str;
Z_STRLEN_P(value) = y;
}
@@ -120,7 +120,7 @@
return;
}
- str = Z_STRVAL_P(value);
+ str = (unsigned char *)Z_STRVAL_P(value);
buf = safe_emalloc(1, Z_STRLEN_P(value) + 1, 1);
c = 0;
for (i = 0; i < Z_STRLEN_P(value); i++) {
@@ -134,7 +134,7 @@
/* update zval string data */
buf[c] = '\0';
efree(Z_STRVAL_P(value));
- Z_STRVAL_P(value) = buf;
+ Z_STRVAL_P(value) = (char *)buf;
Z_STRLEN_P(value) = c;
}
/* }}} */
@@ -149,7 +149,7 @@
{
int l, i;
- l = strlen(allowed_list);
+ l = strlen((char*)allowed_list);
for (i = 0; i < l; ++i) {
(*map)[allowed_list[i]] = flag;
}
@@ -160,7 +160,7 @@
unsigned char *buf, *str;
int i, c;
- str = Z_STRVAL_P(value);
+ str = (unsigned char *)Z_STRVAL_P(value);
buf = safe_emalloc(1, Z_STRLEN_P(value) + 1, 1);
c = 0;
for (i = 0; i < Z_STRLEN_P(value); i++) {
@@ -172,7 +172,7 @@
/* update zval string data */
buf[c] = '\0';
efree(Z_STRVAL_P(value));
- Z_STRVAL_P(value) = buf;
+ Z_STRVAL_P(value) = (char *)buf;
Z_STRLEN_P(value) = c;
}
/* }}} */
@@ -255,7 +255,7 @@
void php_filter_email(PHP_INPUT_FILTER_PARAM_DECL)
{
/* Check section 6 of rfc 822 http://www.faqs.org/rfcs/rfc822.html */
- unsigned char *allowed_list = LOWALPHA HIALPHA DIGIT
"!#$%&'*+-/=?^_`{|[EMAIL PROTECTED]";
+ unsigned char allowed_list[] = LOWALPHA HIALPHA DIGIT
"!#$%&'*+-/=?^_`{|[EMAIL PROTECTED]";
filter_map map;
filter_map_init(&map);
@@ -269,7 +269,7 @@
{
/* Strip all chars not part of section 5 of
* http://www.faqs.org/rfcs/rfc1738.html */
- unsigned char *allowed_list = LOWALPHA HIALPHA DIGIT SAFE EXTRA
NATIONAL PUNCTUATION RESERVED;
+ unsigned char allowed_list[] = LOWALPHA HIALPHA DIGIT SAFE EXTRA
NATIONAL PUNCTUATION RESERVED;
filter_map map;
filter_map_init(&map);
@@ -282,7 +282,7 @@
void php_filter_number_int(PHP_INPUT_FILTER_PARAM_DECL)
{
/* strip everything [^0-9+-] */
- unsigned char *allowed_list = "+-" DIGIT;
+ unsigned char allowed_list[] = "+-" DIGIT;
filter_map map;
filter_map_init(&map);
@@ -295,7 +295,7 @@
void php_filter_number_float(PHP_INPUT_FILTER_PARAM_DECL)
{
/* strip everything [^0-9+-] */
- unsigned char *allowed_list = "+-" DIGIT;
+ unsigned char allowed_list[] = "+-" DIGIT;
filter_map map;
filter_map_init(&map);
@@ -303,13 +303,13 @@
/* depending on flags, strip '.', 'e', ",", "'" */
if (flags & FILTER_FLAG_ALLOW_FRACTION) {
- filter_map_update(&map, 2, ".");
+ filter_map_update(&map, 2, (unsigned char *) ".");
}
if (flags & FILTER_FLAG_ALLOW_THOUSAND) {
- filter_map_update(&map, 3, ",");
+ filter_map_update(&map, 3, (unsigned char *) ",");
}
if (flags & FILTER_FLAG_ALLOW_SCIENTIFIC) {
- filter_map_update(&map, 4, "eE");
+ filter_map_update(&map, 4, (unsigned char *) "eE");
}
filter_map_apply(value, &map);
}
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/tests/bug7733.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/filter/tests/bug7733.phpt
diff -u php-src/ext/filter/tests/bug7733.phpt:1.1
php-src/ext/filter/tests/bug7733.phpt:1.2
--- php-src/ext/filter/tests/bug7733.phpt:1.1 Sun May 28 01:12:55 2006
+++ php-src/ext/filter/tests/bug7733.phpt Sat Jul 22 09:51:50 2006
@@ -1,5 +1,5 @@
--TEST--
-input_get_args() filter not reseted between elements
+filter_data() Float exponential weird result
--FILE--
<?php
$data = array(
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/tests/bug7586.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/filter/tests/bug7586.phpt
diff -u php-src/ext/filter/tests/bug7586.phpt:1.1
php-src/ext/filter/tests/bug7586.phpt:1.2
--- php-src/ext/filter/tests/bug7586.phpt:1.1 Tue May 9 11:14:43 2006
+++ php-src/ext/filter/tests/bug7586.phpt Sat Jul 22 09:51:50 2006
@@ -27,7 +27,7 @@
)
);
-$out = input_get_args($args, INPUT_DATA, $data);
+$out = input_get_args(INPUT_DATA, $args, $data);
var_dump($out);
?>
--EXPECTF--
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/tests/032.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/filter/tests/032.phpt
diff -u php-src/ext/filter/tests/032.phpt:1.1
php-src/ext/filter/tests/032.phpt:1.2
--- php-src/ext/filter/tests/032.phpt:1.1 Sun May 14 13:54:10 2006
+++ php-src/ext/filter/tests/032.phpt Sat Jul 22 09:51:50 2006
@@ -29,7 +29,7 @@
);
-$myinputs = input_get_args($args, INPUT_DATA, $data);
+$myinputs = input_get_args(INPUT_DATA, $args, $data);
var_dump($myinputs);
?>
--EXPECT--
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php