Skip to content

XmlFileLoader: bug in path when using network filesystem #24090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Gregwar opened this issue Sep 4, 2017 · 6 comments
Closed

XmlFileLoader: bug in path when using network filesystem #24090

Gregwar opened this issue Sep 4, 2017 · 6 comments

Comments

@Gregwar
Copy link
Contributor

Gregwar commented Sep 4, 2017

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.

@sstok
Copy link
Contributor

sstok commented Sep 5, 2017

FYI, Windows also support mapping a network path to a local drive-name.

@Gregwar
Copy link
Contributor Author

Gregwar commented Sep 5, 2017

This is true, however in this case I can't change the server configuration

@Simperfit
Copy link
Contributor

Simperfit commented Dec 5, 2017

@Gregwar You should create a PR, if it's not the good solution the maintainers will tell you. It does feel like a good solution to me.

@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@carsonbot
Copy link

Just a quick reminder to make a comment on this. If I don't hear anything I'll close this.

@xabbuh
Copy link
Member

xabbuh commented Jan 4, 2021

see #39716

@carsonbot carsonbot removed the Stalled label Jan 4, 2021
@fabpot fabpot closed this as completed Jan 5, 2021
fabpot added a commit that referenced this issue Jan 5, 2021
…om network paths on Windows (xabbuh)

This PR was merged into the 4.4 branch.

Discussion
----------

[DependencyInjection] do not break when loading schemas from network paths on Windows

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #24090
| License       | MIT
| Doc PR        |

Commits
-------

acbafe8 do not break when loading schemas from network paths on Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants