From 3a949cf652b818a31ed3b18eaf50c807797a901b Mon Sep 17 00:00:00 2001 From: David Carlier Date: Mon, 25 May 2026 06:02:18 +0100 Subject: [PATCH 1/2] Fix GH-22142: Assertion failure in zendi_try_get_long() on IS_UNDEF. --- Zend/zend_operators.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index c54f4f0c2a22..a43fdcc9a48b 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -448,6 +448,7 @@ static zend_never_inline zend_long ZEND_FASTCALL zendi_try_get_long(const zval * ZEND_ASSERT(Z_TYPE(dst) == IS_LONG); return Z_LVAL(dst); } + case IS_UNDEF: case IS_RESOURCE: case IS_ARRAY: *failed = true; From e8f28df7a7a35ccec516582ea271094f33a1647a Mon Sep 17 00:00:00 2001 From: David Carlier Date: Mon, 25 May 2026 06:36:22 +0100 Subject: [PATCH 2/2] add test --- ext/zlib/tests/gh22142.phpt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 ext/zlib/tests/gh22142.phpt diff --git a/ext/zlib/tests/gh22142.phpt b/ext/zlib/tests/gh22142.phpt new file mode 100644 index 000000000000..84397a4e85a9 --- /dev/null +++ b/ext/zlib/tests/gh22142.phpt @@ -0,0 +1,20 @@ +--TEST-- +GH-22142 (Assertion failure in zendi_try_get_long() on IS_UNDEF) +--EXTENSIONS-- +zlib +--FILE-- +getMessage(), PHP_EOL; +} + +?> +--EXPECT-- +deflate_init(): Argument #2 ($options) the value for option "level" must be of type int, null given