mirror of
https://github.com/php/php-src.git
synced 2024-12-14 20:33:36 +08:00
c488172975
The original commit for this issue (62b1293
) assumed Z_BLOCK was
only defined in < 1.2.4. However, this flush type *is* defined but
is only unavailable for use with deflate().
This new commit correctly checks the ZLIB_VERNUM constant to
determine if Z_BLOCK flush is available for the current deflate()
operation and triggers an appropriate error as needed.
New ZLIB_VERSION and ZLIB_VERNUM constants are also exposed in
userland to allow testing this behavior in environments running
zlib < 1.2.4 (ZLIB_VERNUM check is needed).
25 lines
539 B
PHP
25 lines
539 B
PHP
--TEST--
|
|
Test deflate_add() errors with ZLIB_BLOCK in zlib < 1.2.4
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded("zlib")) {
|
|
print "skip - ZLIB extension not loaded";
|
|
}
|
|
if (ZLIB_VERNUM >= 0x1240) {
|
|
print "skip - ZLIB < 1.2.4 required for test";
|
|
}
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$resource = deflate_init(ZLIB_ENCODING_GZIP);
|
|
var_dump(deflate_add($resource, "aaaaaaaaaaaaaaaaaaaaaa", ZLIB_BLOCK));
|
|
|
|
?>
|
|
===DONE===
|
|
--EXPECTF--
|
|
|
|
Warning: deflate_add(): zlib >= 1.2.4 required for BLOCK deflate; current version: %s in %s on line %d
|
|
bool(false)
|
|
===DONE===
|