php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #77500 ZipArchive::getFromName works with path, not just name
Submitted: 2019-01-22 16:14 UTC Modified: -
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: jave dot web at seznam dot cz Assigned:
Status: Open Package: Zip Related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jave dot web at seznam dot cz
New email:
PHP Version: OS:

 

 [2019-01-22 16:14 UTC] jave dot web at seznam dot cz
Description:
------------
Documentation for ZipArchive::getFromName is misleading.
The first parameter is actually a relative (to root of the archive) path, docs say "Name" which can falsely imply file would be found just by its filename, which doesn't happen when it is inside a directory.

To get to a deeper file, you must specify the path like:
$zip->getFromName('subFolderTest/test.txt');

---
From manual page: https://php.net/ziparchive.getfromname
---


Test script:
---------------
//considering archive structure
//subFolderTest (d)
// - test.txt (f)
// - test2.txt (f)

$zip->getFromName('test.txt'); //this will not find anything
$zip->getFromName('subFolderTest/test.txt'); //this will find the file


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Jun 16 14:01:27 2019 UTC