php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69153 filenames with ? not consistently supported
Submitted: 2015-03-01 20:05 UTC Modified: 2021-01-21 11:48 UTC
From: greg at freephile dot com Assigned:
Status: Verified Package: PHAR related
PHP Version: 5.5.22 OS: Ubuntu 14.04.2 LTS
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: greg at freephile dot com
New email:
PHP Version: OS:

 

 [2015-03-01 20:05 UTC] greg at freephile dot com
Description:
------------
PharData() unable to read filename which DirectoryIterator CAN read, and zip_open() CAN read.

Test script:
---------------
http://pastebin.com/WbEgf0Nz


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-01 20:20 UTC] greg at freephile dot com
Perhaps this is a "documentation issue" since I was able to get the PharData() invocation to work when I passed the flag 'CURRENT_AS_SELF'

$reader->setFlags(FilesystemIterator::CURRENT_AS_SELF);

I don't really know whether this is intended behavior or if there is a bug.
 [2021-01-21 11:48 UTC] cmb@php.net
-Summary: filename causes exception +Summary: filenames with ? not consistently supported -Status: Open +Status: Verified
 [2021-01-21 11:48 UTC] cmb@php.net
The problem is the question mark in the filename
tablepress-combined.min.css?ver=6.css.  This is regarded as the
beginning of a query string[1], so Phar looks for the filename
tablepress-combined.min.css which doesn't exist, because the full
filename has been stored in the Phar's manifest.

Working around by setting CURRENT_AS_SELF helps in this case,
because then phar_path_check() isn't involved.  However, other
means to access the file (e.g. ::__offsetGet()) have the same
issue.

Not sure if this is to be seen as bug or merely a documentation
issue, but it certainly not intended behavior.

And then there is the not directly related issue that question
marks are not valid in filenames on Windows, so extraction would
fail there (same with ext/zip).

[1] <https://github.com/php/php-src/blob/php-7.4.14/ext/phar/phar_path_check.re#L80-L87>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 16:01:29 2024 UTC