Doc #79157 [NEW]: Documentation unclear for ZipArchive::setCompressionName
| From: | kris dot rande at infinite dot com | Date: | Wed, 22 Jan 2020 19:30:30 +0000 |
| Subject: | Doc #79157 [NEW]: Documentation unclear for ZipArchive::setCompressionName | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-17216@lists.php.net to get a copy of this message | ||
From: kris dot rande at infinite dot com
Operating system: Ubuntu 16
PHP version: 7.4.1
Package: zip
Bug Type: Documentation Problem
Bug description:Documentation unclear for ZipArchive::setCompressionName
Description:
------------
---
From manual page: https://php.net/ziparchive.setcompressionname
---
The documentation for ZipArchive::setCompressionName is unclear about
what to pass for the $name parameter.
I wrongly assumed the $name parameter was the path to the source file
($filename parameter when calling ZipArchive::addFile). Through
experimentation I determined it is actually the local name (optional
$localname parameter when calling ZipArchive::addFile).
This could be improved by using "$localname" in all ZipArchive methods.
It would also be helpful to provide a code example that shows
ZipArchive::addFile and ZipArchive::setCompressionName used together.
I've included a proposed example in the "Test script" section below.
Test script:
---------------
<?php
$zip = new ZipArchive;
$res = $zip->open('test.zip', ZipArchive::CREATE);
if ($res === TRUE) {
$zip->addFile('foo.jpg', 'foo', 'Some text');
$zip->setCompressionName('foo', ZipArchive::CM_STORE);
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>
--
Edit bug report at https://bugs.php.net/bug.php?id=79157&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79157&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79157&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79157&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79157&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79157&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79157&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79157&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79157&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79157&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79157&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79157&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79157&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79157&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79157&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79157&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79157&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79157&r=mysqlcfg