https://bugzilla.wikimedia.org/show_bug.cgi?id=28627

             Bug #: 28627
           Summary: wfMakeUrlIndex throws "Undefined index: host" for file
                    links with more than two slashes
           Product: MediaWiki
           Version: 1.18-svn
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: General/Unknown
        AssignedTo: [email protected]
        ReportedBy: [email protected]
    Classification: Unclassified


The function wfMakeUrlIndex() in includes/GlobalFunctions.php throws an error
if passed a file URI that has more than two slashes after "file://".

PHP Notice:  Undefined index: host in <path>/w/includes/GlobalFunctions.php on
line 2636

This is because PHP's parse_url() function handles file URIs differently
depending on the number of slashes after "file:". If you have two slashes, you
get a 'host' array element:

print_r(parse_url('file:///whatever/you/like.txt'));

Array
(
    [scheme] => file
    [host] => whatever
    [path] => /you/like.txt
)

but with three or more slashes, you don't:

print_r(parse_url('file:///whatever/you/like.txt'));

Array
(
    [scheme] => file
    [path] => /whatever/you/like.txt
)

This screws up all references to $bits['host'] in wfMakeUrlIndex.

I believe wfMakeUrlIndex() should handle file URIs specially, just as it does
"mailto" URIs today. It should accept ANY number of slashes after "file:",
because both IE and Firefox today accept these URIs (e.g., representing Windows
network shares).

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to