Doc #79157 [PATCH]: Documentation unclear for ZipArchive::setCompressionName

From: Date: Mon, 24 Feb 2020 09:37:04 +0000
Subject: Doc #79157 [PATCH]: Documentation unclear for ZipArchive::setCompressionName
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17322@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79157&edit=1 ID: 79157 Patch added by: info@sepc.ir Reported by: kris dot rande at infinite dot com Summary: Documentation unclear for ZipArchive::setCompressionName Status: Open Type: Documentation Problem Package: Zip Related Operating System: Ubuntu 16 PHP Version: 7.4.1 Block user comment: N Private report: N New Comment: The following pull request has been associated: Patch Name: fix typo: mysqlx => mysqlx_x On GitHub: https://github.com/php/pecl-database-mysql_xdevapi/pull/8 Patch: https://github.com/php/pecl-database-mysql_xdevapi/pull/8.patch Previous Comments: ------------------------------------------------------------------------ [2020-01-22 19:30:30] kris dot rande at infinite dot com 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 this bug report at https://bugs.php.net/bug.php?id=79157&edit=1

« previous php.doc.bugs (#17322) next »