readme.txt 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. // --------------------------------------------------------------------------------
  2. // PclZip 2.8.4 - readme.txt
  3. // --------------------------------------------------------------------------------
  4. // License GNU/LGPL - August 2009
  5. // Vincent Blavet - vincent@phpconcept.net
  6. // http://www.phpconcept.net
  7. // --------------------------------------------------------------------------------
  8. 0 - Summary
  9. ============
  10. 1 - Introduction
  11. 2 - What's new
  12. 3 - Corrected bugs
  13. 4 - Known bugs or limitations
  14. 5 - License
  15. 6 - Warning
  16. 7 - Documentation
  17. 8 - Author
  18. 9 - Contribute
  19. 1 - Introduction
  20. ================
  21. PclZip is a library that allow you to manage a Zip archive.
  22. Full documentation about PclZip can be found here : http://www.phpconcept.net/pclzip
  23. 2 - What's new
  24. ==============
  25. Version 2.8.4 :
  26. - Update composer.json to indicate that pclzip/pclzip is replaced
  27. Version 2.8.3 :
  28. - Fix compatibility with PHP v7.1
  29. Version 2.8.2 :
  30. - PCLZIP_CB_PRE_EXTRACT and PCLZIP_CB_POST_EXTRACT are now supported with
  31. extraction as a string (PCLZIP_OPT_EXTRACT_AS_STRING). The string
  32. can also be modified in the post-extract call back.
  33. **Bugs correction :
  34. - PCLZIP_OPT_REMOVE_ALL_PATH was not working correctly
  35. - Remove use of eval() and do direct call to callback functions
  36. - Correct support of 64bits systems (Thanks to WordPress team)
  37. Version 2.8.1 :
  38. - Move option PCLZIP_OPT_BY_EREG to PCLZIP_OPT_BY_PREG because ereg() is
  39. deprecated in PHP 5.3. When using option PCLZIP_OPT_BY_EREG, PclZip will
  40. automatically replace it by PCLZIP_OPT_BY_PREG.
  41. Version 2.8 :
  42. - Improve extraction of zip archive for large files by using temporary files
  43. This feature is working like the one defined in r2.7.
  44. Options are renamed : PCLZIP_OPT_TEMP_FILE_ON, PCLZIP_OPT_TEMP_FILE_OFF,
  45. PCLZIP_OPT_TEMP_FILE_THRESHOLD
  46. - Add a ratio constant PCLZIP_TEMPORARY_FILE_RATIO to configure the auto
  47. sense of temporary file use.
  48. - Bug correction : Reduce filepath in returned file list to remove ennoying
  49. './/' preambule in file path.
  50. Version 2.7 :
  51. - Improve creation of zip archive for large files :
  52. PclZip will now autosense the configured memory and use temporary files
  53. when large file is suspected.
  54. This feature can also ne triggered by manual options in create() and add()
  55. methods. 'PCLZIP_OPT_ADD_TEMP_FILE_ON' force the use of temporary files,
  56. 'PCLZIP_OPT_ADD_TEMP_FILE_OFF' disable the autosense technic,
  57. 'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD' allow for configuration of a size
  58. threshold to use temporary files.
  59. Using "temporary files" rather than "memory" might take more time, but
  60. might give the ability to zip very large files :
  61. Tested on my win laptop with a 88Mo file :
  62. Zip "in-memory" : 18sec (max_execution_time=30, memory_limit=180Mo)
  63. Zip "tmporary-files" : 23sec (max_execution_time=30, memory_limit=30Mo)
  64. - Replace use of mktime() by time() to limit the E_STRICT error messages.
  65. - Bug correction : When adding files with full windows path (drive letter)
  66. PclZip is now working. Before, if the drive letter is not the default
  67. path, PclZip was not able to add the file.
  68. Version 2.6 :
  69. - Code optimisation
  70. - New attributes PCLZIP_ATT_FILE_COMMENT gives the ability to
  71. add a comment for a specific file. (Don't really know if this is usefull)
  72. - New attribute PCLZIP_ATT_FILE_CONTENT gives the ability to add a string
  73. as a file.
  74. - New attribute PCLZIP_ATT_FILE_MTIME modify the timestamp associated with
  75. a file.
  76. - Correct a bug. Files archived with a timestamp with 0h0m0s were extracted
  77. with current time
  78. - Add CRC value in the informations returned back for each file after an
  79. action.
  80. - Add missing closedir() statement.
  81. - When adding a folder, and removing the path of this folder, files were
  82. incorrectly added with a '/' at the beginning. Which means files are
  83. related to root in unix systems. Corrected.
  84. - Add conditional if before constant definition. This will allow users
  85. to redefine constants without changing the file, and then improve
  86. upgrade of pclzip code for new versions.
  87. Version 2.5 :
  88. - Introduce the ability to add file/folder with individual properties (file descriptor).
  89. This gives for example the ability to change the filename of a zipped file.
  90. . Able to add files individually
  91. . Able to change full name
  92. . Able to change short name
  93. . Compatible with global options
  94. - New attributes : PCLZIP_ATT_FILE_NAME, PCLZIP_ATT_FILE_NEW_SHORT_NAME, PCLZIP_ATT_FILE_NEW_FULL_NAME
  95. - New error code : PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE
  96. - Add a security control feature. PclZip can extract any file in any folder
  97. of a system. People may use this to upload a zip file and try to override
  98. a system file. The PCLZIP_OPT_EXTRACT_DIR_RESTRICTION will give the
  99. ability to forgive any directory transversal behavior.
  100. - New PCLZIP_OPT_EXTRACT_DIR_RESTRICTION : check extraction path
  101. - New error code : PCLZIP_ERR_DIRECTORY_RESTRICTION
  102. - Modification in PclZipUtilPathInclusion() : dir and path beginning with ./ will be prepend
  103. by current path (getcwd())
  104. Version 2.4 :
  105. - Code improvment : try to speed up the code by removing unusefull call to pack()
  106. - Correct bug in delete() : delete() should be called with no argument. This was not
  107. the case in 2.3. This is corrected in 2.4.
  108. - Correct a bug in path_inclusion function. When the path has several '../../', the
  109. result was bad.
  110. - Add a check for magic_quotes_runtime configuration. If enabled, PclZip will
  111. disable it while working and det it back to its original value.
  112. This resolve a lots of bad formated archive errors.
  113. - Bug correction : PclZip now correctly unzip file in some specific situation,
  114. when compressed content has same size as uncompressed content.
  115. - Bug correction : When selecting option 'PCLZIP_OPT_REMOVE_ALL_PATH',
  116. directories are not any more created.
  117. - Code improvment : correct unclosed opendir(), better handling of . and .. in
  118. loops.
  119. Version 2.3 :
  120. - Correct a bug with PHP5 : affecting the value 0xFE49FFE0 to a variable does not
  121. give the same result in PHP4 and PHP5 ....
  122. Version 2.2 :
  123. - Try development of PCLZIP_OPT_CRYPT .....
  124. However this becomes to a stop. To crypt/decrypt I need to multiply 2 long integers,
  125. the result (greater than a long) is not supported by PHP. Even the use of bcmath
  126. functions does not help. I did not find yet a solution ...;
  127. - Add missing '/' at end of directory entries
  128. - Check is a file is encrypted or not. Returns status 'unsupported_encryption' and/or
  129. error code PCLZIP_ERR_UNSUPPORTED_ENCRYPTION.
  130. - Corrected : Bad "version need to extract" field in local file header
  131. - Add private method privCheckFileHeaders() in order to check local and central
  132. file headers. PclZip is now supporting purpose bit flag bit 3. Purpose bit flag bit 3 gives
  133. the ability to have a local file header without size, compressed size and crc filled.
  134. - Add a generic status 'error' for file status
  135. - Add control of compression type. PclZip only support deflate compression method.
  136. Before v2.2, PclZip does not check the compression method used in an archive while
  137. extracting. With v2.2 PclZip returns a new error status for a file using an unsupported
  138. compression method. New status is "unsupported_compression". New error code is
  139. PCLZIP_ERR_UNSUPPORTED_COMPRESSION.
  140. - Add optional attribute PCLZIP_OPT_STOP_ON_ERROR. This will stop the extract of files
  141. when errors like 'a folder with same name exists' or 'a newer file exists' or
  142. 'a write protected file' exists, rather than set a status for the concerning file
  143. and resume the extract of the zip.
  144. - Add optional attribute PCLZIP_OPT_REPLACE_NEWER. This will force, during an extract' the
  145. replacement of the file, even if a newer version of the file exists.
  146. Note that today if a file with the same name already exists but is older it will be
  147. replaced by the extracted one.
  148. - Improve PclZipUtilOption()
  149. - Support of zip archive with trailing bytes. Before 2.2, PclZip checks that the central
  150. directory structure is the last data in the archive. Crypt encryption/decryption of
  151. zip archive put trailing 0 bytes after decryption. PclZip is now supporting this.
  152. Version 2.1 :
  153. - Add the ability to abort the extraction by using a user callback function.
  154. The user can now return the value '2' in its callback which indicates to stop the
  155. extraction. For a pre call-back extract is stopped before the extration of the current
  156. file. For a post call back, the extraction is stopped after.
  157. - Add the ability to extract a file (or several files) directly in the standard output.
  158. This is done by the new parameter PCLZIP_OPT_EXTRACT_IN_OUTPUT with method extract().
  159. - Add support for parameters PCLZIP_OPT_COMMENT, PCLZIP_OPT_ADD_COMMENT,
  160. PCLZIP_OPT_PREPEND_COMMENT. This will create, replace, add, or prepend comments
  161. in the zip archive.
  162. - When merging two archives, the comments are not any more lost, but merged, with a
  163. blank space separator.
  164. - Corrected bug : Files are not deleted when all files are asked to be deleted.
  165. - Corrected bug : Folders with name '0' made PclZip to abort the create or add feature.
  166. Version 2.0 :
  167. ***** Warning : Some new features may break the backward compatibility for your scripts.
  168. Please carefully read the readme file.
  169. - Add the ability to delete by Index, name and regular expression. This feature is
  170. performed by the method delete(), which uses the optional parameters
  171. PCLZIP_OPT_BY_INDEX, PCLZIP_OPT_BY_NAME, PCLZIP_OPT_BY_EREG or PCLZIP_OPT_BY_PREG.
  172. - Add the ability to extract by regular expression. To extract by regexp you must use the method
  173. extract(), with the option PCLZIP_OPT_BY_EREG or PCLZIP_OPT_BY_PREG
  174. (depending if you want to use ereg() or preg_match() syntax) followed by the
  175. regular expression pattern.
  176. - Add the ability to extract by index, directly with the extract() method. This is a
  177. code improvment of the extractByIndex() method.
  178. - Add the ability to extract by name. To extract by name you must use the method
  179. extract(), with the option PCLZIP_OPT_BY_NAME followed by the filename to
  180. extract or an array of filenames to extract. To extract all a folder, use the folder
  181. name rather than the filename with a '/' at the end.
  182. - Add the ability to add files without compression. This is done with a new attribute
  183. which is PCLZIP_OPT_NO_COMPRESSION.
  184. - Add the attribute PCLZIP_OPT_EXTRACT_AS_STRING, which allow to extract a file directly
  185. in a string without using any file (or temporary file).
  186. - Add constant PCLZIP_SEPARATOR for static configuration of filename separators in a single string.
  187. The default separator is now a comma (,) and not any more a blank space.
  188. THIS BREAK THE BACKWARD COMPATIBILITY : Please check if this may have an impact with
  189. your script.
  190. - Improve algorythm performance by removing the use of temporary files when adding or
  191. extracting files in an archive.
  192. - Add (correct) detection of empty filename zipping. This can occurs when the removed
  193. path is the same
  194. as a zipped dir. The dir is not zipped (['status'] = filtered), only its content.
  195. - Add better support for windows paths (thanks for help from manus@manusfreedom.com).
  196. - Corrected bug : When the archive file already exists with size=0, the add() method
  197. fails. Corrected in 2.0.
  198. - Remove the use of OS_WINDOWS constant. Use php_uname() function rather.
  199. - Control the order of index ranges in extract by index feature.
  200. - Change the internal management of folders (better handling of internal flag).
  201. Version 1.3 :
  202. - Removing the double include check. This is now done by include_once() and require_once()
  203. PHP directives.
  204. - Changing the error handling mecanism : Remove the use of an external error library.
  205. The former PclError...() functions are replaced by internal equivalent methods.
  206. By changing the environment variable PCLZIP_ERROR_EXTERNAL you can still use the former library.
  207. Introducing the use of constants for error codes rather than integer values. This will help
  208. in futur improvment.
  209. Introduction of error handling functions like errorCode(), errorName() and errorInfo().
  210. - Remove the deprecated use of calling function with arguments passed by reference.
  211. - Add the calling of extract(), extractByIndex(), create() and add() functions
  212. with variable options rather than fixed arguments.
  213. - Add the ability to remove all the file path while extracting or adding,
  214. without any need to specify the path to remove.
  215. This is available for extract(), extractByIndex(), create() and add() functionS by using
  216. the new variable options parameters :
  217. - PCLZIP_OPT_REMOVE_ALL_PATH : by indicating this option while calling the fct.
  218. - Ability to change the mode of a file after the extraction (chmod()).
  219. This is available for extract() and extractByIndex() functionS by using
  220. the new variable options parameters.
  221. - PCLZIP_OPT_SET_CHMOD : by setting the value of this option.
  222. - Ability to definition call-back options. These call-back will be called during the adding,
  223. or the extracting of file (extract(), extractByIndex(), create() and add() functions) :
  224. - PCLZIP_CB_PRE_EXTRACT : will be called before each extraction of a file. The user
  225. can trigerred the change the filename of the extracted file. The user can triggered the
  226. skip of the extraction. This is adding a 'skipped' status in the file list result value.
  227. - PCLZIP_CB_POST_EXTRACT : will be called after each extraction of a file.
  228. Nothing can be triggered from that point.
  229. - PCLZIP_CB_PRE_ADD : will be called before each add of a file. The user
  230. can trigerred the change the stored filename of the added file. The user can triggered the
  231. skip of the add. This is adding a 'skipped' status in the file list result value.
  232. - PCLZIP_CB_POST_ADD : will be called after each add of a file.
  233. Nothing can be triggered from that point.
  234. - Two status are added in the file list returned as function result : skipped & filename_too_long
  235. 'skipped' is used when a call-back function ask for skipping the file.
  236. 'filename_too_long' is used while adding a file with a too long filename to archive (the file is
  237. not added)
  238. - Adding the function PclZipUtilPathInclusion(), that check the inclusion of a path into
  239. a directory.
  240. - Add a check of the presence of the archive file before some actions (like list, ...)
  241. - Add the initialisation of field "index" in header array. This means that by
  242. default index will be -1 when not explicitly set by the methods.
  243. Version 1.2 :
  244. - Adding a duplicate function.
  245. - Adding a merge function. The merge function is a "quick merge" function,
  246. it just append the content of an archive at the end of the first one. There
  247. is no check for duplicate files or more recent files.
  248. - Improve the search of the central directory end.
  249. Version 1.1.2 :
  250. - Changing the license of PclZip. PclZip is now released under the GNU / LGPL license
  251. (see License section).
  252. - Adding the optional support of a static temporary directory. You will need to configure
  253. the constant PCLZIP_TEMPORARY_DIR if you want to use this feature.
  254. - Improving the rename() function. In some cases rename() does not work (different
  255. Filesystems), so it will be replaced by a copy() + unlink() functions.
  256. Version 1.1.1 :
  257. - Maintenance release, no new feature.
  258. Version 1.1 :
  259. - New method Add() : adding files in the archive
  260. - New method ExtractByIndex() : partial extract of the archive, files are identified by
  261. their index in the archive
  262. - New method DeleteByIndex() : delete some files/folder entries from the archive,
  263. files are identified by their index in the archive.
  264. - Adding a test of the zlib extension presence. If not present abort the script.
  265. Version 1.0.1 :
  266. - No new feature
  267. 3 - Corrected bugs
  268. ==================
  269. Corrected in Version 2.0 :
  270. - Corrected : During an extraction, if a call-back fucntion is used and try to skip
  271. a file, all the extraction process is stopped.
  272. Corrected in Version 1.3 :
  273. - Corrected : Support of static synopsis for method extract() is broken.
  274. - Corrected : invalid size of archive content field (0xFF) should be (0xFFFF).
  275. - Corrected : When an extract is done with a remove_path parameter, the entry for
  276. the directory with exactly the same path is not skipped/filtered.
  277. - Corrected : extractByIndex() and deleteByIndex() were not managing index in the
  278. right way. For example indexes '1,3-5,11' will only extract files 1 and 11. This
  279. is due to a sort of the index resulting table that puts 11 before 3-5 (sort on
  280. string and not interger). The sort is temporarilly removed, this means that
  281. you must provide a sorted list of index ranges.
  282. Corrected in Version 1.2 :
  283. - Nothing.
  284. Corrected in Version 1.1.2 :
  285. - Corrected : Winzip is unable to delete or add new files in a PclZip created archives.
  286. Corrected in Version 1.1.1 :
  287. - Corrected : When archived file is not compressed (0% compression), the
  288. extract method fails.
  289. Corrected in Version 1.1 :
  290. - Corrected : Adding a complete tree of folder may result in a bad archive
  291. creation.
  292. Corrected in Version 1.0.1 :
  293. - Corrected : Error while compressing files greater than PCLZIP_READ_BLOCK_SIZE (default=1024).
  294. 4 - Known bugs or limitations
  295. =============================
  296. Please publish bugs reports in SourceForge :
  297. http://sourceforge.net/tracker/?group_id=40254&atid=427564
  298. In Version 2.x :
  299. - PclZip does only support file uncompressed or compressed with deflate (compression method 8)
  300. - PclZip does not support password protected zip archive
  301. - Some concern were seen when changing mtime of a file while archiving.
  302. Seems to be linked to Daylight Saving Time (PclTest_changing_mtime).
  303. In Version 1.2 :
  304. - merge() methods does not check for duplicate files or last date of modifications.
  305. In Version 1.1 :
  306. - Limitation : Using 'extract' fields in the file header in the zip archive is not supported.
  307. - WinZip is unable to delete a single file in a PclZip created archive. It is also unable to
  308. add a file in a PclZip created archive. (Corrected in v.1.2)
  309. In Version 1.0.1 :
  310. - Adding a complete tree of folder may result in a bad archive
  311. creation. (Corrected in V.1.1).
  312. - Path given to methods must be in the unix format (/) and not the Windows format (\).
  313. Workaround : Use only / directory separators.
  314. - PclZip is using temporary files that are sometime the name of the file with a .tmp or .gz
  315. added suffix. Files with these names may already exist and may be overwritten.
  316. Workaround : none.
  317. - PclZip does not check if the zlib extension is present. If it is absent, the zip
  318. file is not created and the lib abort without warning.
  319. Workaround : enable the zlib extension on the php install
  320. In Version 1.0 :
  321. - Error while compressing files greater than PCLZIP_READ_BLOCK_SIZE (default=1024).
  322. (Corrected in v.1.0.1)
  323. - Limitation : Multi-disk zip archive are not supported.
  324. 5 - License
  325. ===========
  326. Since version 1.1.2, PclZip Library is released under GNU/LGPL license.
  327. This library is free, so you can use it at no cost.
  328. HOWEVER, if you release a script, an application, a library or any kind of
  329. code using PclZip library (or a part of it), YOU MUST :
  330. - Indicate in the documentation (or a readme file), that your work
  331. uses PclZip Library, and make a reference to the author and the web site
  332. http://www.phpconcept.net
  333. - Gives the ability to the final user to update the PclZip libary.
  334. I will also appreciate that you send me a mail (vincent@phpconcept.net), just to
  335. be aware that someone is using PclZip.
  336. For more information about GNU/LGPL license : http://www.gnu.org
  337. 6 - Warning
  338. =================
  339. This library and the associated files are non commercial, non professional work.
  340. It should not have unexpected results. However if any damage is caused by this software
  341. the author can not be responsible.
  342. The use of this software is at the risk of the user.
  343. 7 - Documentation
  344. =================
  345. PclZip User Manuel is available in English on PhpConcept : http://www.phpconcept.net/pclzip/man/en/index.php
  346. A Russian translation was done by Feskov Kuzma : http://php.russofile.ru/ru/authors/unsort/zip/
  347. 8 - Author
  348. ==========
  349. This software was written by Vincent Blavet (vincent@phpconcept.net) on its leasure time.
  350. 9 - Contribute
  351. ==============
  352. If you want to contribute to the development of PclZip, please contact vincent@phpconcept.net.
  353. If you can help in financing PhpConcept hosting service, please go to
  354. http://www.phpconcept.net/soutien.php