Skip to content

Commit 9db074d

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix crash in property existence test in ext/zip
2 parents e3c2301 + 46a15ed commit 9db074d

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
@@ -46,6 +46,9 @@ PHP NEWS
4646
. Fixed bug GH-20439 (xml_set_default_handler() does not properly handle
4747
special characters in attributes when passing data to callback). (ndossche)
4848

49+
- Zip:
50+
. Fix crash in property existence test. (ndossche)
51+
4952
20 Nov 2025, PHP 8.4.15
5053

5154
- Core:

ext/zip/php_zip.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,9 +977,8 @@ static int php_zip_has_property(zend_object *object, zend_string *name, int type
977977
} else if (type == 0) {
978978
retval = (Z_TYPE(tmp) != IS_NULL);
979979
}
980+
zval_ptr_dtor(&tmp);
980981
}
981-
982-
zval_ptr_dtor(&tmp);
983982
} else {
984983
retval = zend_std_has_property(object, name, type, cache_slot);
985984
}
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)