Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

bzip2.decompress stream wrapper truncates valid bz2 files from pbzip2

Aperta
#24,170 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@kairosci ci sta già lavorando.

Dal 25/10/2026.

  • #24690 di @kairosci — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
57/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c, php
Ambito
api, backend

Direzione di ricerca

Start by comparing the compress.bzip2:// wrapper path with the bzip2.decompress stream filter, using the provided PHP example as a reproducer. Trace where concatenated-stream handling differs and add a regression test for the wrapper with two concatenated bz2 streams; done means both reads return 900004 bytes without truncation.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug Extension: bz2 Status: Verified
Description

pbzip2 slices a file into 900000 byte blocks and then concatenates the streams. The default PHP behavior for using libbzip2 stops after the first concatenated stream without warning. This results in silently truncated reads.

The following code:

<?php
$f = tempnam(sys_get_temp_dir(), 'bz');
file_put_contents($f, bzcompress(str_repeat('a', 900000)) . bzcompress('tail'));  // two streams
echo strlen(file_get_contents("compress.bzip2://$f")), "\n";   // 900000 if truncated, 900004 if not
$fp = fopen($f, 'rb');
stream_filter_append($fp, 'bzip2.decompress', STREAM_FILTER_READ, ['concatenated' => true]);
echo strlen(stream_get_contents($fp)), "\n";                   // 900004

Resulted in this output:

900000
900004

But I expected this output instead:

900004
900004
PHP Version
PHP 8.5.11 (cli) (built: Sep 24 2026 14:38:36) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.5.11, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.11, Copyright (c), by Zend Technologies
Operating System

Debian 12.15

Lingua principale
C
Stelle
40.7k
Fork
8.3k
Merge medio
2g 16h
PR unite (30g)
151

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di php/php-src

Tutte le issue di php/php-src

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.