From 66bbf58e084c741e9e5b9a3a7d5d1f772f855aaf Mon Sep 17 00:00:00 2001 From: oheil Date: Sat, 11 Mar 2023 17:10:42 +0100 Subject: [PATCH] Auto-Update fails with php 8.2.3 --- webmail/update.php | 78 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 3 deletions(-) diff --git a/webmail/update.php b/webmail/update.php index 7299bd7..d473a60 100644 --- a/webmail/update.php +++ b/webmail/update.php @@ -325,13 +325,20 @@ else { } } echo '

Compressing archive: '.$archive_name.'.gz

'; - $archive->compress(Phar::GZ); + //the following failes in php 8.2 with Allowed memory size exhausted + //$archive->compress(Phar::GZ); + $gzfile=gzcompressfile($archive_name); unset($archive); echo '

Removing file: '.$archive_name.'

'; Phar::unlinkArchive($archive_name); - $archive=new PharData($archive_name.'.gz'); + + $archive_name=gzdecompress($gzfile); + $archive=new PharData($archive_name); + $number_of_files_check=$archive->count(); unset($archive); + unlink($archive_name); + if( $number_of_files==$number_of_files_check ) { echo '

Created archive of '.$number_of_files_check.' files successfully: '.$archive_name.'.gz

'; } @@ -407,9 +414,15 @@ else { $archive->close(); } else { - $archive=new PharData($archive_name); + //the following failes in php 8.2 with Allowed memory size exhausted + //$archive=new PharData($archive_name); + + $tar_archive_name=gzdecompress($archive_name); + $archive=new PharData($tar_archive_name); + $archive->extractTo('.'); unset($archive); + unlink($tar_archive_name); } chdir($target_extract_dir); $file_list=recursive_directory(".","/^.*(?