diff --git a/NEWS b/NEWS index 61912827f3d..d40e47f0148 100644 --- a/NEWS +++ b/NEWS @@ -39,6 +39,9 @@ PHP NEWS . Fixed bug GH-20439 (xml_set_default_handler() does not properly handle special characters in attributes when passing data to callback). (ndossche) +- Zip: + . Fix crash in property existence test. (ndossche) + 13 Nov 2025, PHP 8.5.0RC5 - Core: diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index ff2006d56f0..871c30dc003 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -934,9 +934,8 @@ static int php_zip_has_property(zend_object *object, zend_string *name, int type } else if (type == 0) { retval = (Z_TYPE(tmp) != IS_NULL); } + zval_ptr_dtor(&tmp); } - - zval_ptr_dtor(&tmp); } else { retval = zend_std_has_property(object, name, type, cache_slot); } diff --git a/ext/zip/tests/property_existence_test.phpt b/ext/zip/tests/property_existence_test.phpt new file mode 100644 index 00000000000..855bf73464a --- /dev/null +++ b/ext/zip/tests/property_existence_test.phpt @@ -0,0 +1,20 @@ +--TEST-- +Property existence test can cause a crash +--EXTENSIONS-- +zip +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(1) { + [0]=> + int(-1) +}