From 41e8173ba25c56fc27858b8cea134b8087275b92 Mon Sep 17 00:00:00 2001 From: mike_something Date: Wed, 29 Mar 2017 07:51:02 +0300 Subject: [PATCH] Update class class-pclzip.php Installing a plugin results in a warning because a 0 filesize is passed to fread() Changed to read the filesize before passing to fread() --- src/wp-admin/includes/class-pclzip.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/includes/class-pclzip.php b/src/wp-admin/includes/class-pclzip.php index ae0af7a8f101c..93446efc5a4a8 100644 --- a/src/wp-admin/includes/class-pclzip.php +++ b/src/wp-admin/includes/class-pclzip.php @@ -4205,11 +4205,16 @@ function privExtractFileAsString(&$p_entry, &$p_string, &$p_options) // ----- Do the extraction (if not a folder) if (!(($p_entry['external']&0x00000010)==0x00000010)) { // ----- Look for not compressed file - // if ($p_entry['compressed_size'] == $p_entry['size']) if ($p_entry['compression'] == 0) { - - // ----- Reading the file - $p_string = @fread($this->zip_fd, $p_entry['compressed_size']); + if ($p_entry['compressed_size'] == 0){ + // ----- Fread requires a non zero length parameter + // ----- Reading the file + $p_string = @fread($this->zip_fd, filesize($this->zipname)); + } + else { + // ----- Reading the file + $p_string = @fread($this->zip_fd, $p_entry['compressed_size']); + } } else {