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 toxzencode(string $data, int $level = -1, int $format = XZ_FORMAT_XZ).xzdecode()gained a$memory_limitparameter.
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_LZMA2select the codec filter.dict_size,lc,lp, andpbcan 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_XZXZ_FORMAT_RAWXZ_FILTER_LZMA1XZ_FILTER_LZMA2
Notes
- No
.xz-only behavior has changed. Defaults remain fully backward-compatible, soxz_encode_init()andxzencode()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.