Skip to content

Commit a75e120

Browse files
committed
Convert resources to objects in ext/zlib
1 parent 217f6e1 commit a75e120

9 files changed

+258
-175
lines changed

UPGRADING

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ PHP 8.0 UPGRADE NOTES
440440

441441
- Sysvmsg:
442442
. msg_get_queue() will now return an SysvMessageQueue object rather than a
443-
resource. Return value checks using is_resource() should be replaced with
443+
resource. Return value checks using is_resource() should be replaced with
444444
checks for `false`.
445445

446446
- Sysvsem:
@@ -469,6 +469,12 @@ PHP 8.0 UPGRADE NOTES
469469

470470
- Zlib:
471471
. gzgetss() has been removed.
472+
. inflate_init() will now return an InflateContext object rather than a
473+
resource. Return value checks using is_resource() should be replaced with
474+
checks for `false`.
475+
. deflate_init() will now return a DeflateContext object rather than a
476+
resource. Return value checks using is_resource() should be replaced with
477+
checks for `false`.
472478

473479
========================================
474480
2. New Features

ext/zlib/php_zlib.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ typedef struct _php_zlib_context {
4747
int status;
4848
size_t inflateDictlen;
4949
php_zlib_buffer buffer;
50+
zend_object std;
5051
} php_zlib_context;
5152

5253
ZEND_BEGIN_MODULE_GLOBALS(zlib)

ext/zlib/tests/deflate_add_error.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ try {
2727

2828
?>
2929
--EXPECT--
30-
deflate_add(): supplied resource is not a valid zlib deflate resource
31-
Flush mode must be ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK or ZLIB_FINISH
30+
deflate_add(): Argument #1 ($context) must be of type DeflateContext, resource given
31+
deflate_add(): Argument #3 ($flush_behavior) must be one of ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK, or ZLIB_FINISH

ext/zlib/tests/deflate_init_error.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ try {
4141

4242
?>
4343
--EXPECT--
44-
Encoding mode must be ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE
45-
Compression level (42) must be within -1..9
46-
Compression level (-2) must be within -1..9
47-
Compression memory level (0) must be within 1..9
48-
Compression memory level (10) must be within 1..9
44+
deflate_init(): Argument #1 ($encoding) must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
45+
deflate_init(): "level" option must be between -1 and 9
46+
deflate_init(): "level" option must be between -1 and 9
47+
deflate_init(): "memory" option must be between 1 and 9
48+
deflate_init(): "memory" option must be between 1 and 9

ext/zlib/tests/dictionary_usage.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ var_dump($dictStr_a === $a);
1818
$r = inflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => $dict]);
1919
var_dump(inflate_add($r, $a, ZLIB_FINISH));
2020

21-
2221
$r = inflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => ["8"] + range("a", "z")]);
2322
var_dump(inflate_add($r, $a, ZLIB_FINISH));
2423

ext/zlib/tests/inflate_add_error.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ try {
2626

2727
?>
2828
--EXPECT--
29-
inflate_add(): supplied resource is not a valid zlib inflate resource
30-
Flush mode must be ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK or ZLIB_FINISH
29+
inflate_add(): Argument #1 ($context) must be of type InflateContext, resource given
30+
inflate_add(): Argument #3 ($flush_mode) must be one of ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK, ZLIB_FINISH

0 commit comments

Comments
 (0)