mirror of
https://github.com/php/php-src.git
synced 2024-12-25 09:49:08 +08:00
Merge branch 'PHP-5.4' into PHP-5.5
This commit is contained in:
commit
f8a9a47e8c
@ -80,6 +80,11 @@ static int php_filter_parse_int(const char *str, unsigned int str_len, long *ret
|
||||
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');
|
||||
|
@ -10,9 +10,13 @@ precision=14
|
||||
/* Integer */
|
||||
$data = "-123"; var_dump(filter_var($data, FILTER_VALIDATE_INT));
|
||||
$data = "0"; var_dump(filter_var($data, FILTER_VALIDATE_INT));
|
||||
$data = "-0"; var_dump(filter_var($data, FILTER_VALIDATE_INT));
|
||||
$data = "+0"; var_dump(filter_var($data, FILTER_VALIDATE_INT));
|
||||
$data = "123"; var_dump(filter_var($data, FILTER_VALIDATE_INT));
|
||||
$data = -123; var_dump(filter_var($data, FILTER_VALIDATE_INT));
|
||||
$data = 0; var_dump(filter_var($data, FILTER_VALIDATE_INT));
|
||||
$data = -0; var_dump(filter_var($data, FILTER_VALIDATE_INT));
|
||||
$data = +0; var_dump(filter_var($data, FILTER_VALIDATE_INT));
|
||||
$data = 123; var_dump(filter_var($data, FILTER_VALIDATE_INT));
|
||||
$data = ""; var_dump(filter_var($data, FILTER_VALIDATE_INT));
|
||||
echo "\n";
|
||||
@ -46,9 +50,13 @@ $data = ""; var_dump(filter_var($data, FILTER_VALIDATE_BOOLEAN));
|
||||
--EXPECT--
|
||||
int(-123)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(123)
|
||||
int(-123)
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(123)
|
||||
bool(false)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user