]> granicus.if.org Git - php/commitdiff
MFB: Fixed bug #38859 (parse_url() fails if passing '@' in passwd).
authorIlia Alshanetsky <iliaa@php.net>
Thu, 28 Sep 2006 14:52:55 +0000 (14:52 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 28 Sep 2006 14:52:55 +0000 (14:52 +0000)
ext/standard/tests/strings/url_t.phpt
ext/standard/url.c

index c0063fb3b4ee07a5e6d5442b02961289e94b87b8..21ba55a21a41eff931b1b4fc8a4ade355bad1474 100644 (file)
@@ -71,6 +71,7 @@ $sample_urls = array (
 'scheme:',
 'foo+bar://baz@bang/bla',
 'gg:9130731',
+'http://user:@pass@host/path?argument?value#etc',
 );
 
     foreach ($sample_urls as $url) {
@@ -525,11 +526,11 @@ array(7) {
   ["scheme"]=>
   string(4) "http"
   ["host"]=>
-  string(19) "hideout@www.php.net"
+  string(11) "www.php.net"
   ["port"]=>
   int(80)
   ["user"]=>
-  string(6) "secret"
+  string(14) "secret@hideout"
   ["path"]=>
   string(10) "/index.php"
   ["query"]=>
@@ -685,6 +686,22 @@ array(2) {
   ["path"]=>
   string(7) "9130731"
 }
+array(7) {
+  ["scheme"]=>
+  string(4) "http"
+  ["host"]=>
+  string(4) "host"
+  ["user"]=>
+  string(4) "user"
+  ["pass"]=>
+  string(5) "@pass"
+  ["path"]=>
+  string(5) "/path"
+  ["query"]=>
+  string(14) "argument?value"
+  ["fragment"]=>
+  string(3) "etc"
+}
 string(4) "http"
 string(11) "www.php.net"
 int(80)
index 41e03d5a34e265026ab6e305409c4ed09b55e8e8..a1e90f833e0a6cb90fbbee00269b7a2ebb8c9c5e 100644 (file)
@@ -211,7 +211,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
        }       
                
        /* check for login and password */
-       if ((p = memchr(s, '@', (e-s)))) {
+       if ((p = zend_memrchr(s, '@', (e-s)))) {
                if ((pp = memchr(s, ':', (p-s)))) {
                        if ((pp-s) > 0) {
                                ret->user = estrndup(s, (pp-s));