PHP warning

ZipArchive::close(): Invalid or uninitialized Zip object

/mnt/data/shnoulle/nginx/www/3LTS/application/helpers/common_helper.php(5056)

5044 function get_zip_originalsize($filename)
5045 {
5046 
5047     if (class_exists('ZipArchive')) {
5048         $size = 0;
5049         $zip = new ZipArchive;
5050         $zip->open($filename);
5051 
5052         for ($i = 0; $i < $zip->numFiles; $i++) {
5053                 $aEntry = $zip->statIndex($i);
5054                 $size += $aEntry['size'];
5055         }
5056         $zip->close();
5057         return $size;
5058     }else{
5059         if ( YII_DEBUG ){
5060             Yii::app()->setFlashMessage("Warning! The PHP Zip extension is not installed on this server. You're not protected from ZIP bomb attacks.", 'error');
5061         }
5062     }
5063 
5064     return -1;
5065 }
5066 
5067 /**
5068  * PHP7 has created a little nasty bomb with count throwing erroros on uncountables

Stack Trace

#0
+
 /mnt/data/shnoulle/nginx/www/3LTS/application/helpers/common_helper.php(5056): ZipArchive->close()
5051 
5052         for ($i = 0; $i < $zip->numFiles; $i++) {
5053                 $aEntry = $zip->statIndex($i);
5054                 $size += $aEntry['size'];
5055         }
5056         $zip->close();
5057         return $size;
5058     }else{
5059         if ( YII_DEBUG ){
5060             Yii::app()->setFlashMessage("Warning! The PHP Zip extension is not installed on this server. You're not protected from ZIP bomb attacks.", 'error');
5061         }
#1
+
 /mnt/data/shnoulle/nginx/www/3LTS/application/helpers/common_helper.php(5035): get_zip_originalsize("/mnt/data/shnoulle/nginx/www/3LTS/tmp/errorpage_vanilla.zip")
5030  * @param string $zip_filename
5031  * @return int
5032  */
5033 function isZipBomb($zip_filename)
5034 {
5035     return ( get_zip_originalsize($zip_filename) >  Yii::app()->getConfig('maximum_unzipped_size') );
5036 }
5037 
5038 /**
5039  * Get the original size of a zip archive to prevent Zip Bombing
5040  * see comment here : http://php.net/manual/en/function.zip-entry-filesize.php
#2
+
 /mnt/data/shnoulle/nginx/www/3LTS/application/third_party/pclzip/pclzip.lib.php(226): isZipBomb("/mnt/data/shnoulle/nginx/www/3LTS/tmp/errorpage_vanilla.zip")
221       die('Abort '.basename(__FILE__).' : Missing zlib extensions');
222     }
223 
224 
225     // Added by LS Team to prevent Zip Bombing
226     if ($bCheckZipBomb && isZipBomb($p_zipname)){
227         die('Abort '.basename(__FILE__).' : Unzipped file is bigger than upload_max_filesize or post_max_size');
228     }
229 
230 
231     // ----- Set the attributes
2021-05-17 12:31:45 nginx/1.20.0 Yii Framework/1.1.24-dev