PHP zip:// and parse_url…

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!

This is an imported post. It was imported from my old blog using an automated tool and may contain formatting errors and/or broken images.

Leave a Comment