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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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: Fri Nov 22 22:01:27 2019 UTC