mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.5'
* PHP-8.5: Fix crash in property existence test in ext/zip
This commit is contained in:
@@ -928,17 +928,16 @@ static int php_zip_has_property(zend_object *object, zend_string *name, int type
|
||||
if (hnd != NULL) {
|
||||
zval tmp, *prop;
|
||||
|
||||
if (type == 2) {
|
||||
if (type == ZEND_PROPERTY_EXISTS) {
|
||||
retval = true;
|
||||
} else if ((prop = php_zip_property_reader(obj, hnd, &tmp)) != NULL) {
|
||||
if (type == 1) {
|
||||
if (type == ZEND_PROPERTY_NOT_EMPTY) {
|
||||
retval = zend_is_true(&tmp);
|
||||
} else if (type == 0) {
|
||||
} else if (type == ZEND_PROPERTY_ISSET) {
|
||||
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);
|
||||
}
|
||||
|
||||
20
ext/zip/tests/property_existence_test.phpt
Normal file
20
ext/zip/tests/property_existence_test.phpt
Normal file
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Property existence test can cause a crash
|
||||
--EXTENSIONS--
|
||||
zip
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$archive = new ZipArchive(__DIR__.'/property_existence.zip');
|
||||
var_dump(array_column([$archive], 'lastId'));
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__.'/property_existence.zip');
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(-1)
|
||||
}
|
||||
Reference in New Issue
Block a user