Skip to content

[Bug] xzdecode returns incomplete data (12288 bytes vs expected 12360) #14

@mgfzgw

Description

@mgfzgw

Bug Report

Description

xzdecode() returns incomplete decompressed data (12288 bytes) while the system xz command correctly extracts the same file to the expected size of 12360 bytes.

Environment

  • OS: Windows 10 x64
  • PHP version: 8.0.2
  • Extension version: 1.2.1
  • DLL file: php_xz-1.2.1-8.0-nts-vs16-x86_64
  • Thread safety: NTS (Non-Thread Safe)
  • Architecture: x64
  • Compiler: VS16

Steps to Reproduce

  1. Take a valid .xz file (compressed from a 12360-byte source)
  2. Read the file content via file_get_contents()
  3. Pass the compressed data to xzdecode()
  4. Compare the output length with the expected size

Minimal Test Code

$xzFilePath = 'path/to/your/file.xz';
$compressedData = file_get_contents($xzFilePath);
$decompressedData = xzdecode($compressedData);

echo 'Expected size: 12360 bytes' . PHP_EOL;
echo 'Actual size: ' . strlen($decompressedData) . ' bytes' . PHP_EOL;

[demo.zip](https://github.com/user-attachments/files/27154706/demo.zip)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions