Phar Class decompressFiles() bad in PHP 7.4 and 8.x branches
Offen
Dieses Issue hat noch niemand übernommen.
Bug
Extension: phar
Status: Verified
- Vorherrschende Sprache
- C
- Sterne
- 40.4k
- Forks
- 8.1k
- Ø Merge
- 2 T. 13 Std.
- Gemergte PRs (30 T.)
- 96
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der bereitgestellten Phar::compressFiles()- und Phar::decompressFiles()-Reproduktion auf PHP 7.4 oder 8.x und verfolge anschließend die Phar-Implementierung und ihre Tests. Als erledigt gilt, dass decompressFiles() extrahierte Dateien mit ihrem ursprünglichen Text statt mit komprimierten Bytes hinterlässt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- c, php
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 38/100