|  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: -
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
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:

From manual page:

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


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Jan 23 01:01:23 2020 UTC