Skip to content

Commit

Permalink
Merge branch 'PHP-5.4' into PHP-5.5
Browse files Browse the repository at this point in the history
* PHP-5.4:
  NEWS for added reserved ip addresses according to RFC 6598
  Add RFC 6598 IPs to reserved addresses
  • Loading branch information
dsp committed Sep 17, 2013
2 parents 3d6ac70 + dfd7d10 commit 5e3da04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions ext/filter/logical_filters.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
if (flags & FILTER_FLAG_NO_RES_RANGE) {
if (
(ip[0] == 0) ||
(ip[0] == 100 && (ip[1] == 0 || ip[1] <= 127)) ||
(ip[0] == 128 && ip[1] == 0) ||
(ip[0] == 191 && ip[1] == 255) ||
(ip[0] == 169 && ip[1] == 254) ||
Expand Down
4 changes: 4 additions & 0 deletions ext/filter/tests/018.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ var_dump(filter_var("192.168.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE));
var_dump(filter_var("127.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("192.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("100.0.0.0", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("100.127.255.255", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP));
var_dump(filter_var("256.1237.123.1", FILTER_VALIDATE_IP));
var_dump(filter_var("255.255.255.255", FILTER_VALIDATE_IP));
Expand All @@ -40,6 +42,8 @@ bool(false)
string(12) "192.0.34.166"
bool(false)
string(9) "192.0.0.1"
bool(false)
bool(false)
string(12) "192.0.34.166"
bool(false)
string(15) "255.255.255.255"
Expand Down

0 comments on commit 5e3da04

Please sign in to comment.