com web/rmtools: check for 0 byte lic file, fix zip operation with many files: client/include/PeclExt.php

From: Date: Tue, 22 Oct 2013 15:37:55 +0000
Subject: com web/rmtools: check for 0 byte lic file, fix zip operation with many files: client/include/PeclExt.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-19117@lists.php.net to get a copy of this message
Commit: 55123caeafcc21cb618794f3a607a931b9331a3a Author: Anatol Belski <ab@php.net> Tue, 22 Oct 2013 17:37:55 +0200 Parents: e5b3c0b52395eed3b7f5744ad271fcf405b48b7c Branches: master Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=55123caeafcc21cb618794f3a607a931b9331a3a Log: check for 0 byte lic file, fix zip operation with many files Changed paths: M client/include/PeclExt.php Diff: diff --git a/client/include/PeclExt.php b/client/include/PeclExt.php index 6026d3d..c5ea58f 100644 --- a/client/include/PeclExt.php +++ b/client/include/PeclExt.php @@ -547,6 +547,7 @@ if (!function_exists('rmtools\combinations')) { public function checkLicense() { $license_found = false; + $license_file_empty = true; foreach ($this->lic_fnames as $name) { $pat = $this->tmp_extract_path . DIRECTORY_SEPARATOR . $name; @@ -555,14 +556,27 @@ if (!function_exists('rmtools\combinations')) { if (is_array($glob) && !empty($glob)) { $license_found = true; + + foreach ($glob as $fl) { + $fsize = filesize($fl); + /* XXX check some minimal length? */ + if (false !== $fsize && $fsize > 0) { + $license_file_empty = false; + break; + } + } + break; } } if (!$license_found) { throw new \Exception("No LICENSE or COPYING was found in the package '" . $this->name .. "'"); + } else { + if ($license_file_empty) { + throw new \Exception("License file of zero size"); + } } - } @@ -807,10 +821,12 @@ nodoc: /* pack */ $zip_file = TMP_DIR . DIRECTORY_SEPARATOR . $this->getPackageName() . '.zip'; - $zip_cmd = $this->zip_cmd . ' -9 -D -j ' . $zip_file . ' ' . implode(' ', $files_to_zip); - system($zip_cmd, $status); - if ($status) { - throw new \Exception("Couldn't zip files for '$zip_file'"); + foreach ($files_to_zip as $file_to_zip) { + $zip_cmd = $this->zip_cmd . ' -9 -D -m ' . $zip_file . ' ' . $files_to_zip; + system($zip_cmd, $status); + if ($status) { + throw new \Exception("Couldn't zip files for '$zip_file'"); + } } return $zip_file;

« previous php.webmaster (#19117) next »