Skip to content
Maarten Balliauw
← back
Personal 1 min read

PHP zip:// and parse_url...

edit this page

After having a few months of problems using PHP and fopen(‘zip://something.xlsx#xl/worksheets/sheet1.xml’, ‘r’), I finally found the reason of that exact line of code giving errors on some PC’s… Assuming this uses a call to parse_url under the hood, I tried parsing this, resulting in the following URL parts:

Array

(

[scheme] => zip

[host] => something.xlsx#xl

[path] => /worksheets/sheet1.xml

)

That’s just not correct… Parsing should return the following:

Conclusion: beware when using parse_url and the zip file wrapper!

Maarten Balliauw

Writing about .NET, web, performance and security, since 2006.

Related posts

★ Prefer this blog on Google