php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64922 不可预料的压缩文件末端
Submitted: 2013-05-25 07:44 UTC Modified: 2013-06-10 08:00 UTC
From: hkzkx at qq dot com Assigned:
Status: No Feedback Package: zip (PECL)
PHP Version: master-Git-2013-05-25 (Git) OS: window2003Server x64
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-05-25 07:44 UTC] hkzkx at qq dot com
Description:
------------
---
From manual page: http://www.php.net/ziparchive.open#refsect1-ziparchive.open-
parameters
---
$path = 'D:/wordDocs/';
$count = 0;


function archive($path, $local)
{
	global $zip, $count;
	if ($handle = opendir($path)) {
		while (($file = readdir($handle)) !== false) {
			if (($file != ".") && ($file != "..")) {
				echo "$file<br>";
				echo var_dump($local, $file, $path);
				if (is_dir($path . $file)) {
					$zip->addEmptyDir($local . $file . "/");
					archive($path . $file . "/", $local . 
$file . "/");
				} elseif (is_file($path . $file)) {
					if ($count > 128) {
						$zip->close();
						$zip->open($GLOBALS["file"]);
						$count = 0;
					}
					$zip->addFile($path . $file, $local . 
$file);
					$count++;
				}
			}
		}
		closedir($handle);
	}
	echo "count: $count\n";
}
$file = 'D:/'.time().'.zip';

$zip = new ZipArchive();

if (($zip->open($file, ZipArchive::CREATE)) === TRUE) {
	archive($path, null);
	$zip->close();

}

echo "done\n";


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-06-03 08:54 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2013-06-03 08:54 UTC] ab@php.net
Please specify what the issue is, expected and actual. English preferred :)
 [2013-06-10 08:00 UTC] ab@php.net
-Status: Feedback +Status: No Feedback
 [2013-06-10 08:00 UTC] ab@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 10:01:29 2024 UTC