svn: /php/php-src/ branches/PHP_5_2/ext/filter/logical_filters.c branches/PHP_5_2/ext/filter/tests/bug51192.phpt
branches/PHP_5_3/ext/filter/logical_filters.c branches/PHP_5_3/ext/filter/tests/bug51192.phpt trunk/ext/filter/logical_filters.c
trunk/ext/filter/tests/bug51192.phpt

From: Date: Wed, 03 Mar 2010 09:25:50 +0000
Subject: svn: /php/php-src/ branches/PHP_5_2/ext/filter/logical_filters.c branches/PHP_5_2/ext/filter/tests/bug51192.phpt
branches/PHP_5_3/ext/filter/logical_filters.c branches/PHP_5_3/ext/filter/tests/bug51192.phpt trunk/ext/filter/logical_filters.c
trunk/ext/filter/tests/bug51192.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-61951@lists.php.net to get a copy of this message
aharvey Wed, 03 Mar 2010 09:25:50 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=295773 Log: Fix for bug #51192 (FILTER_VALIDATE_URL will invalidate a hostname that includes '-'). Original patch by solar@azrael.ws. Bug: http://bugs.php.net/51192 (Assigned) FILTER_VALIDATE_URL will invalidate a hostname that includes '-' Changed paths: U php/php-src/branches/PHP_5_2/ext/filter/logical_filters.c A php/php-src/branches/PHP_5_2/ext/filter/tests/bug51192.phpt U php/php-src/branches/PHP_5_3/ext/filter/logical_filters.c A php/php-src/branches/PHP_5_3/ext/filter/tests/bug51192.phpt U php/php-src/trunk/ext/filter/logical_filters.c A php/php-src/trunk/ext/filter/tests/bug51192.phpt 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 2010-03-03 06:31:15 UTC (rev 295772) +++ php/php-src/branches/PHP_5_2/ext/filter/logical_filters.c 2010-03-03 09:25:50 UTC (rev 295773) @@ -467,7 +467,7 @@ s = url->host; while (s < e) { - if (!isalnum((int)*(unsigned char *)s) && *s != '_' && *s != '.') { + if (!isalnum((int)*(unsigned char *)s) && *s != '-' && *s != '.') { goto bad_url; } s++; Added: php/php-src/branches/PHP_5_2/ext/filter/tests/bug51192.phpt =================================================================== --- php/php-src/branches/PHP_5_2/ext/filter/tests/bug51192.phpt (rev 0) +++ php/php-src/branches/PHP_5_2/ext/filter/tests/bug51192.phpt 2010-03-03 09:25:50 UTC (rev 295773) @@ -0,0 +1,13 @@ +--TEST-- +bug 51192, FILTER_VALIDATE_URL will invalidate a hostname that includes '-' +--SKIPIF-- +<?php if (!extension_loaded("filter")) die("skip"); ?> +--FILE-- +<?php +var_dump(filter_var('http://example.com/path', FILTER_VALIDATE_URL)); +var_dump(filter_var('http://exa-mple.com/path', FILTER_VALIDATE_URL)); +var_dump(filter_var('http://exa_mple.com/path', FILTER_VALIDATE_URL)); +--EXPECT-- +string(23) "http://example.com/path" +string(24) "http://exa-mple.com/path" +bool(false) Modified: php/php-src/branches/PHP_5_3/ext/filter/logical_filters.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/filter/logical_filters.c 2010-03-03 06:31:15 UTC (rev 295772) +++ php/php-src/branches/PHP_5_3/ext/filter/logical_filters.c 2010-03-03 09:25:50 UTC (rev 295773) @@ -467,7 +467,7 @@ s = url->host; while (s < e) { - if (!isalnum((int)*(unsigned char *)s) && *s != '_' && *s != '.') { + if (!isalnum((int)*(unsigned char *)s) && *s != '-' && *s != '.') { goto bad_url; } s++; Added: php/php-src/branches/PHP_5_3/ext/filter/tests/bug51192.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/filter/tests/bug51192.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/filter/tests/bug51192.phpt 2010-03-03 09:25:50 UTC (rev 295773) @@ -0,0 +1,13 @@ +--TEST-- +bug 51192, FILTER_VALIDATE_URL will invalidate a hostname that includes '-' +--SKIPIF-- +<?php if (!extension_loaded("filter")) die("skip"); ?> +--FILE-- +<?php +var_dump(filter_var('http://example.com/path', FILTER_VALIDATE_URL)); +var_dump(filter_var('http://exa-mple.com/path', FILTER_VALIDATE_URL)); +var_dump(filter_var('http://exa_mple.com/path', FILTER_VALIDATE_URL)); +--EXPECT-- +string(23) "http://example.com/path" +string(24) "http://exa-mple.com/path" +bool(false) Modified: php/php-src/trunk/ext/filter/logical_filters.c =================================================================== --- php/php-src/trunk/ext/filter/logical_filters.c 2010-03-03 06:31:15 UTC (rev 295772) +++ php/php-src/trunk/ext/filter/logical_filters.c 2010-03-03 09:25:50 UTC (rev 295773) @@ -467,7 +467,7 @@ s = url->host; while (s < e) { - if (!isalnum((int)*(unsigned char *)s) && *s != '_' && *s != '.') { + if (!isalnum((int)*(unsigned char *)s) && *s != '-' && *s != '.') { goto bad_url; } s++; Added: php/php-src/trunk/ext/filter/tests/bug51192.phpt =================================================================== --- php/php-src/trunk/ext/filter/tests/bug51192.phpt (rev 0) +++ php/php-src/trunk/ext/filter/tests/bug51192.phpt 2010-03-03 09:25:50 UTC (rev 295773) @@ -0,0 +1,13 @@ +--TEST-- +bug 51192, FILTER_VALIDATE_URL will invalidate a hostname that includes '-' +--SKIPIF-- +<?php if (!extension_loaded("filter")) die("skip"); ?> +--FILE-- +<?php +var_dump(filter_var('http://example.com/path', FILTER_VALIDATE_URL)); +var_dump(filter_var('http://exa-mple.com/path', FILTER_VALIDATE_URL)); +var_dump(filter_var('http://exa_mple.com/path', FILTER_VALIDATE_URL)); +--EXPECT-- +string(23) "http://example.com/path" +string(24) "http://exa-mple.com/path" +bool(false)

« previous php.cvs (#61951) next »