10000 XmlFileLoader: bug in path when using network filesystem · Issue #24090 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
XmlFileLoader: bug in path when using network filesystem #24090
Closed
@Gregwar

Description

@Gregwar
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

      0