must not contain empty strings

Description

The deflate_init() function accepts options. Among the options, there is a dictionary, with a dictionary of preset strings. Theses strings cannot be left empty.

Before PHP 8.2, this bug would crash PHP.

Example

<?php
try {
    deflate_init(ZLIB_ENCODING_DEFLATE, [dictionary => [, ]]);
} catch (ValueError $ex) {
    echo $ex->getMessage(), \n;
}
?>

Solutions

  • Remove the 2nd argument.

  • Remove the ‘dictionary’ entry in the 2nd argument.

  • Put an actual value in the values of the ‘dictionary’ entry in the 2nd argument.