Skip to content

Commit 75cd8fb

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Fix crash in property existence test in ext/zip
2 parents 01bca99 + 9db074d commit 75cd8fb

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ PHP NEWS
3939
. Fixed bug GH-20439 (xml_set_default_handler() does not properly handle
4040
special characters in attributes when passing data to callback). (ndossche)
4141

42+
- Zip:
43+
. Fix crash in property existence test. (ndossche)
44+
4245
13 Nov 2025, PHP 8.5.0RC5
4346

4447
- Core:

ext/zip/php_zip.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -934,9 +934,8 @@ static int php_zip_has_property(zend_object *object, zend_string *name, int type
934934
} else if (type == 0) {
935935
retval = (Z_TYPE(tmp) != IS_NULL);
936936
}
937+
zval_ptr_dtor(&tmp);
937938
}
938-
939-
zval_ptr_dtor(&tmp);
940939
} else {
941940
retval = zend_std_has_property(object, name, type, cache_slot);
942941
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Property existence test can cause a crash
3+
--EXTENSIONS--
4+
zip
5+
--FILE--
6+
<?php
7+
8+
$archive = new ZipArchive(__DIR__.'/property_existence.zip');
9+
var_dump(array_column([$archive], 'lastId'));
10+
11+
?>
12+
--CLEAN--
13+
<?php
14+
@unlink(__DIR__.'/property_existence.zip');
15+
?>
16+
--EXPECT--
17+
array(1) {
18+
[0]=>
19+
int(-1)
20+
}

0 commit comments

Comments
 (0)