[prev in list] [next in list] [prev in thread] [next in thread]
List: php-doc-bugs
Subject: [DOC-BUGS] Doc #79157 [Asn->Csd]: Documentation unclear for ZipArchive::setCompressionName
From: remi () php ! net
Date: 2020-03-18 12:37:02
Message-ID: E1jEXwU-0001bV-4s () bugs ! php ! net
[Download RAW message or body]
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&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
--
PHP Documentation Bugs Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic