Skip to content

v2.1.0

Latest

Choose a tag to compare

@mateuszanella mateuszanella released this 12 Aug 22:04
· 1 commit to main since this release

v2.1.0

Raw LZMA1/LZMA2 stream support and a format-aware API, allowing the extension to build custom containers (e.g. archives) on top of bare LZMA codec streams.

Breaking Changes

  • xz_encode_init() / xz_decode_init() signatures changed to (int $format, array $options):
    • xz_encode_init(XZ_CHECK_CRC64, [...])xz_encode_init(XZ_FORMAT_XZ, ['check' => XZ_CHECK_CRC64, ...])
    • xz_decode_init($flags, $memory_limit)xz_decode_init(XZ_FORMAT_XZ, ['flags' => ..., 'memory_limit' => ...])
  • xzencode() signature changed to xzencode(string $data, int $level = -1, int $format = XZ_FORMAT_XZ).
  • xzdecode() gained a $memory_limit parameter.

New Features

Raw Streams

XZ_FORMAT_RAW produces and consumes bare LZMA1/LZMA2 streams with no container, header, or integrity check.

Codec Control

  • XZ_FILTER_LZMA1 / XZ_FILTER_LZMA2 select the codec filter.
  • dict_size, lc, lp, and pb can be used to tune LZMA parameters.

Codec Properties

xz_encode_get_properties() returns the codec property bytes needed to embed a stream in a custom container:

  • 1 byte for LZMA2
  • 5 bytes for LZMA1

One-Shot Raw Encoding

xzencode($data, -1, XZ_FORMAT_RAW) emits a raw LZMA2 stream.

xzdecode() accepts an explicit memory limit for controlling decoder resource usage.

New Constants

  • XZ_FORMAT_XZ
  • XZ_FORMAT_RAW
  • XZ_FILTER_LZMA1
  • XZ_FILTER_LZMA2

Notes

  • No .xz-only behavior has changed. Defaults remain fully backward-compatible, so xz_encode_init() and xzencode() with no arguments continue to work.
  • The stream wrapper (xzopen) remains .xz-container-only. Level and memory usage are configurable via the mode string and stream context options.
  • Internal cleanup: option parsing and buffer-size constants have been moved out of the main header.