felipe Thu, 16 Jul 2009 23:32:16 +0000
URL: http://svn.php.net/viewvc?view=revision&revision=284213
Changed paths:
U php/php-src/branches/PHP_5_2/NEWS
U php/php-src/branches/PHP_5_2/ext/filter/logical_filters.c
A php/php-src/branches/PHP_5_2/ext/filter/tests/bug48762.phpt
Log:
- MFH: Fixed bug #48762 (IPv6 address filter still rejects valid address)
Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS 2009-07-16 23:29:36 UTC (rev 284212)
+++ php/php-src/branches/PHP_5_2/NEWS 2009-07-16 23:32:16 UTC (rev 284213)
@@ -8,6 +8,7 @@
(naf at altlinux dot ru, Felipe)
- Fixed bug #48788 (RecursiveDirectoryIterator doesn't descend into symlinked
directories). (Ilia)
+- Fixed bug #48762 (IPv6 address filter still rejects valid address). (Felipe)
- Fixed bug #48733 (CURLOPT_WRITEHEADER|CURLOPT_FILE|CURLOPT_STDERR warns on
files that have been opened with r+). (Ilia)
- Fixed bug #48718 (FILTER_VALIDATE_EMAIL does not allow numbers in domain
Modified: php/php-src/branches/PHP_5_2/ext/filter/logical_filters.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/filter/logical_filters.c 2009-07-16
23:29:36 UTC (rev 284212)
+++ php/php-src/branches/PHP_5_2/ext/filter/logical_filters.c 2009-07-16
23:32:16 UTC (rev 284213)
@@ -529,7 +529,7 @@
int compressed = 0;
int blocks = 8;
int n;
- char *ipv4 = NULL;
+ char *ipv4;
char *end;
int ip4elm[4];
char *s = str;
@@ -555,24 +555,21 @@
blocks = 6;
}
- end = ipv4 ? ipv4 : str + str_len;
+ end = str + str_len;
while (str < end) {
if (*str == ':') {
if (--blocks == 0) {
- if ((str+1) == end && ipv4) {
- return 1;
- }
return 0;
}
if (++str >= end) {
- return (ipv4 && ipv4 == str && blocks == 3) ||
0;
+ return 0;
}
if (*str == ':') {
if (compressed || --blocks == 0) {
return 0;
}
- if (++str == end || (ipv4 && ipv4 == str)) {
+ if (++str == end) {
return 1;
}
compressed = 1;
Added: php/php-src/branches/PHP_5_2/ext/filter/tests/bug48762.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/filter/tests/bug48762.phpt
(rev 0)
+++ php/php-src/branches/PHP_5_2/ext/filter/tests/bug48762.phpt 2009-07-16
23:32:16 UTC (rev 284213)
@@ -0,0 +1,12 @@
+--TEST--
+Bug #48762 (IPv6 address filter still rejects valid address)
+--FILE--
+<?php
+
+var_dump(filter_var('0b15:23::3:67.98.234.17', FILTER_VALIDATE_IP,
FILTER_FLAG_IPV6));
+var_dump(filter_var('::67:78b:34.43.43.2', FILTER_VALIDATE_IP,
FILTER_FLAG_IPV6));
+
+?>
+--EXPECT--
+string(23) "0b15:23::3:67.98.234.17"
+string(19) "::67:78b:34.43.43.2"
Property changes on: php/php-src/branches/PHP_5_2/ext/filter/tests/bug48762.phpt
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php