iliaa Mon Apr 25 19:47:38 2005 EDT Modified files: /php-src/ext/standard/tests/strings url_t.phpt /php-src/ext/standard url.c Log: Fixed bug #32813 (parse_url() does not handle scheme-only urls properly). http://cvs.php.net/diff.php/php-src/ext/standard/tests/strings/url_t.phpt?r1=1.8&r2=1.9&ty=u Index: php-src/ext/standard/tests/strings/url_t.phpt diff -u php-src/ext/standard/tests/strings/url_t.phpt:1.8 php-src/ext/standard/tests/strings/url_t.phpt:1.9 --- php-src/ext/standard/tests/strings/url_t.phpt:1.8 Thu Jan 27 11:37:34 2005 +++ php-src/ext/standard/tests/strings/url_t.phpt Mon Apr 25 19:47:37 2005 @@ -67,7 +67,8 @@ 'file://path/to/file', 'file:/path/to/file', 'http://1.2.3.4:/abc.asp?a=1&b=2', -'http://foo.com#bar' +'http://foo.com#bar', +'scheme:' ); foreach ($sample_urls as $url) { @@ -657,3 +658,7 @@ ["fragment"]=> string(3) "bar" } +array(1) { + ["scheme"]=> + string(6) "scheme" +} http://cvs.php.net/diff.php/php-src/ext/standard/url.c?r1=1.83&r2=1.84&ty=u Index: php-src/ext/standard/url.c diff -u php-src/ext/standard/url.c:1.83 php-src/ext/standard/url.c:1.84 --- php-src/ext/standard/url.c:1.83 Thu Jan 27 11:37:32 2005 +++ php-src/ext/standard/url.c Mon Apr 25 19:47:37 2005 @@ -15,7 +15,7 @@ | Author: Jim Winstead <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: url.c,v 1.83 2005/01/27 16:37:32 iliaa Exp $ */ +/* $Id: url.c,v 1.84 2005/04/25 23:47:37 iliaa Exp $ */ #include <stdlib.h> #include <string.h> @@ -104,6 +104,12 @@ /* parse scheme */ if ((e = memchr(s, ':', length)) && (e - s)) { + if (*(e + 1) == '\0') { /* only scheme is available */ + ret->scheme = estrndup(s, (e - s)); + php_replace_controlchars_ex(ret->scheme, (e - s)); + goto end; + } + /* * certain schemas like mailto: and zlib: may not have any / after them * this check ensures we support those. @@ -303,7 +309,7 @@ ret->path = estrndup(s, (ue-s)); php_replace_controlchars_ex(ret->path, (ue - s)); } - +end: return ret; } /* }}} */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php