Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ PHP NEWS
. Enabled the TAILCALL VM on Windows when compiling with Clang >= 19 x86_64.
(henderkes)
. Deprecate specifying a nullable return type for __debugInfo(). (timwolla)
. Fixed bug GH-22142 (Assertion failure in zendi_try_get_long() on IS_UNDEF).
(David Carlier)

- BCMath:
. Added NUL-byte validation to BCMath functions. (jorgsowa)
Expand Down
1 change: 1 addition & 0 deletions Zend/zend_operators.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 20 additions & 0 deletions ext/zlib/tests/gh22142.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
GH-22142 (Assertion failure in zendi_try_get_long() on IS_UNDEF)
--EXTENSIONS--
zlib
--FILE--
<?php

class Options {
public int $level;
}

try {
deflate_init(ZLIB_ENCODING_DEFLATE, new Options());
} catch (TypeError $e) {
echo $e->getMessage(), PHP_EOL;
}

?>
--EXPECT--
deflate_init(): Argument #2 ($options) the value for option "level" must be of type int, null given