Commit:    36b88d77f2a9d0ac74692a679f636ccb5d11589f
Author:    Andrew Faulds <a...@ajf.me>         Mon, 20 Aug 2012 00:03:55 +0100
Committer: Stanislav Malyshev <s...@php.net>      Sun, 19 Aug 2012 22:15:58 
-0700
Parents:   675545f042fc08d015a27ee2c88d16d4d2e4ce04
Branches:  PHP-5.4 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=36b88d77f2a9d0ac74692a679f636ccb5d11589f

Log:
bug #62844; relative URL schemes in parse_url()

Bugs:
https://bugs.php.net/62844

Changed paths:
  A  ext/standard/tests/url/parse_url_relative_scheme.phpt
  M  ext/standard/url.c


Diff:
diff --git a/ext/standard/tests/url/parse_url_relative_scheme.phpt 
b/ext/standard/tests/url/parse_url_relative_scheme.phpt
new file mode 100644
index 0000000..7c8952d
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_relative_scheme.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Test parse_url() function: Checks relative URL schemes (e.g. "//example.com")
+--FILE--
+<?php
+var_dump(parse_url('//example.org'));
+--EXPECT--
+array(1) {
+  ["host"]=>
+  string(11) "example.org"
+}
+
diff --git a/ext/standard/url.c b/ext/standard/url.c
index 0555c7b..f1e48a1 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -204,6 +204,8 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int 
length)
                } else {
                        goto just_path;
                }
+       } else if (*s == '/' && *(s+1) == '/') { /* same-scheme (relative) URL 
*/
+               s += 2;
        } else {
                just_path:
                ue = s + length;


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to