[php-src] Issue #8469: Phar Class decompressFiles() bad in PHP 7.4 and 8.x branches

From: Date: Sun, 01 May 2022 01:57:07 +0000
Subject: [php-src] Issue #8469: Phar Class decompressFiles() bad in PHP 7.4 and 8.x branches
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241352@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8469 Author: kwince ### Description The following code: ... `<?php $p = new Phar('/home/gearond/my.phar', FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS, 'my.phar'); $p['myfile.txt'] = 'four score and seven years ago our fathers.'; $p['myfile2.txt'] = 'four score and severn years ago our mothers.'; foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } var_dump($p->getSupportedCompression() ); var_dump( $p->compressFiles(Phar::GZ) ); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } var_dump( $p->decompressFiles() ); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } var_dump( $p->extractTo("/home/gearond/Project/exploration", null, true) ); ?>` Resulted in this output: ``` string(10) "myfile.txt" bool(false) bool(false) bool(false) string(11) "myfile2.txt" bool(false) bool(false) bool(false) array(1) { [0]=> string(2) "GZ" } NULL string(10) "myfile.txt" bool(true) bool(false) bool(true) string(11) "myfile2.txt" bool(true) bool(false) bool(true) bool(true) string(10) "myfile.txt" bool(false) bool(false) bool(false) string(11) "myfile2.txt" bool(false) bool(false) bool(false) bool(true) gearond@gearond-XPS-15-9570:~/Project/exploration$ cat *.txt K�/-R(N�/JUH�KQ(N-K-�S�LM,*VHL�WI��d��K�/-R(N�/JUH�KQ(N-K�S�LM,*VHL�Wɦ%�d��gearond@gearond-XPS-15-9570:~/Project/exploration$ ``` But I expected this output instead: ``` string(10) "myfile.txt" bool(false) bool(false) bool(false) string(11) "myfile2.txt" bool(false) bool(false) bool(false) array(1) { [0]=> string(2) "GZ" } NULL string(10) "myfile.txt" bool(true) bool(false) bool(true) string(11) "myfile2.txt" bool(true) bool(false) bool(true) bool(true) string(10) "myfile.txt" bool(false) bool(false) bool(false) string(11) "myfile2.txt" bool(false) bool(false) bool(false) bool(true) gearond@gearond-XPS-15-9570:~/Project/exploration$ cat *.txt cat *.txt four score and severn years ago our mothers.four score and seven years ago our fathers.gearond@gearond-XPS-15-9570:~/Project/exploration$ ### PHP Version php 8.1.2 and 7.4 ### Operating System ubuntu 20.04 and 22.04

« previous php.bugs (#241352) next »