--- embedaddon/php/ext/filter/logical_filters.c 2012/05/29 12:34:39 1.1.1.2 +++ embedaddon/php/ext/filter/logical_filters.c 2014/06/15 20:03:48 1.1.1.4 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2012 The PHP Group | + | Copyright (c) 1997-2014 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: logical_filters.c,v 1.1.1.2 2012/05/29 12:34:39 misho Exp $ */ +/* $Id: logical_filters.c,v 1.1.1.4 2014/06/15 20:03:48 misho Exp $ */ #include "php_filter.h" #include "filter_private.h" @@ -80,6 +80,11 @@ static int php_filter_parse_int(const char *str, unsig break; } + if (*str == '0' && str + 1 == end) { + /* Special cases: +0 and -0 */ + return 1; + } + /* must start with 1..9*/ if (str < end && *str >= '1' && *str <= '9') { ctx_value = ((sign)?-1:1) * ((*(str++)) - '0'); @@ -235,12 +240,15 @@ void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL) / int len = Z_STRLEN_P(value); int ret; - PHP_FILTER_TRIM_DEFAULT(str, len); + PHP_FILTER_TRIM_DEFAULT_EX(str, len, 0); /* returns true for "1", "true", "on" and "yes" * returns false for "0", "false", "off", "no", and "" * null otherwise. */ switch (len) { + case 0: + ret = 0; + break; case 1: if (*str == '1') { ret = 1; @@ -286,7 +294,7 @@ void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL) / ret = -1; } - if (ret == -1) { + if (ret == -1) { RETURN_VALIDATION_FAILED } else { zval_dtor(value); @@ -476,10 +484,6 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DE } s++; } - - if (*(e - 1) == '.') { - goto bad_url; - } } if ( @@ -710,8 +714,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DEC if (flags & FILTER_FLAG_NO_RES_RANGE) { if ( (ip[0] == 0) || - (ip[0] == 128 && ip[1] == 0) || - (ip[0] == 191 && ip[1] == 255) || + (ip[0] == 100 && (ip[1] >= 64 && ip[1] <= 127)) || (ip[0] == 169 && ip[1] == 254) || (ip[0] == 192 && ip[1] == 0 && ip[2] == 2) || (ip[0] == 127 && ip[1] == 0 && ip[2] == 0 && ip[3] == 1) ||