--- a/wp/wp-admin/includes/class-pclzip.php Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-admin/includes/class-pclzip.php Wed Sep 21 18:19:35 2022 +0200
@@ -1171,7 +1171,7 @@
$this->privErrorReset();
// ----- Look if the $p_archive is a PclZip object
- if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip'))
+ if (is_object($p_archive) && $p_archive instanceof pclzip)
{
// ----- Duplicate the archive
@@ -1235,7 +1235,7 @@
}
// ----- Look if the $p_archive_to_add is a PclZip object
- if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip'))
+ if (is_object($p_archive_to_add) && $p_archive_to_add instanceof pclzip)
{
// ----- Merge the archive
@@ -2674,7 +2674,12 @@
}
// ----- Read the file content
- $v_content = @fread($v_file, $p_header['size']);
+ if ($p_header['size'] > 0) {
+ $v_content = @fread($v_file, $p_header['size']);
+ }
+ else {
+ $v_content = '';
+ }
// ----- Close the file
@fclose($v_file);
@@ -3884,7 +3889,12 @@
// ----- Read the compressed file in a buffer (one shot)
- $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+ if ($p_entry['compressed_size'] > 0) {
+ $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+ }
+ else {
+ $v_buffer = '';
+ }
// ----- Decompress the file
$v_file_content = @gzinflate($v_buffer);
@@ -4096,7 +4106,12 @@
if ($p_entry['compressed_size'] == $p_entry['size']) {
// ----- Read the file in a buffer (one shot)
- $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+ if ($p_entry['compressed_size'] > 0) {
+ $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+ }
+ else {
+ $v_buffer = '';
+ }
// ----- Send the file to the output
echo $v_buffer;
@@ -4105,7 +4120,12 @@
else {
// ----- Read the compressed file in a buffer (one shot)
- $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+ if ($p_entry['compressed_size'] > 0) {
+ $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+ }
+ else {
+ $v_buffer = '';
+ }
// ----- Decompress the file
$v_file_content = gzinflate($v_buffer);
@@ -4209,12 +4229,22 @@
if ($p_entry['compression'] == 0) {
// ----- Reading the file
- $p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
+ if ($p_entry['compressed_size'] > 0) {
+ $p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
+ }
+ else {
+ $p_string = '';
+ }
}
else {
// ----- Reading the file
- $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
+ if ($p_entry['compressed_size'] > 0) {
+ $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
+ }
+ else {
+ $v_data = '';
+ }
// ----- Decompress the file
if (($p_string = @gzinflate($v_data)) === FALSE) {