Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

XmlFileLoader: bug in path when using network filesystem #24090

Copy link
Copy link
Closed
@Gregwar

Description

@Gregwar
Issue body actions
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.3.8

On Windows, when using a filesystem that is located on the network, the path doesn't begin with a drive (like in C:\some\path) but with \\ (like in \\SOMEHOST\some\path)

This can cause the following error crash during the dependency container generation:

InvalidArgumentException: [WARNING 1549] failed to load external entity "file:////HOST/WWW/perso/username/sf/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd" (in n/a - line 0, column 0)

For instance, in Component/DependencyInjection/Loader/XmlFileLoader.php, replacing the following:

$drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
$location = 'file:///'.$drive.implode('/', array_map('rawurlencode', $parts));

With:

if (0 !== stripos($location, '//')) {
  $drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
  $location = 'file:///'.$drive.implode('/', array_map('rawurlencode', $parts));
}

Fixes this issue.
I can make a PR, but I'm not sure this is the good solution.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.