Doc #79157 [Asn->Csd]: Documentation unclear for ZipArchive::setCompressionName

From: Date: Wed, 18 Mar 2020 12:37:02 +0000
Subject: Doc #79157 [Asn->Csd]: Documentation unclear for ZipArchive::setCompressionName
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17433@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 Updated by: remi@php.net Reported by: kris dot rande at infinite dot com Summary: Documentation unclear for ZipArchive::setCompressionName -Status: Assigned +Status: Closed Type: Documentation Problem Package: Zip Related Operating System: Ubuntu 16 PHP Version: 7.4.1 Assigned To: remi Block user comment: N Private report: N New Comment: The fix for this bug has been committed. If you are still experiencing this bug, try to check out latest source from https://github.com/php/php-src and re-test. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2020-03-18 12:36:35] remi@php.net Second ex added in https://github.com/php/doc-en/commit/b709972b451ff912220d32456e48f0cab038fc15 ------------------------------------------------------------------------ [2020-03-18 12:35:53] remi@php.net Automatic comment from SVN on behalf of remi Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=349488 Log: add another ex from #79157 ------------------------------------------------------------------------ [2020-02-24 09:37:04] info at sepc dot ir 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 ------------------------------------------------------------------------ [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 (#17433) next »