Commit fb27990d3d2 for php.net
commit fb27990d3d266644d39d0e9dc430803f0d14aa5a
Merge: 265c0c632ba b18b11ee28a
Author: Niels Dossche <7771979+ndossche@users.noreply.github.com>
Date: Sat Jan 10 15:10:53 2026 +0100
Merge branch 'PHP-8.5'
* PHP-8.5:
Fix GH-20882: phar buildFromIterator breaks with missing base directory
diff --cc ext/phar/phar_object.c
index 17000ca3c0f,20e1e69ca57..338cdc705d0
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@@ -1382,14 -1395,14 +1382,14 @@@ static phar_entry_data *phar_build_entr
static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
{
zval *value;
- bool close_fp = 1;
+ bool close_fp = true;
struct _phar_t *p_obj = (struct _phar_t*) puser;
- size_t str_key_len, base_len = ZSTR_LEN(p_obj->base);
+ size_t str_key_len, base_len = p_obj->base ? ZSTR_LEN(p_obj->base) : 0;
phar_entry_data *data;
php_stream *fp;
size_t fname_len;
size_t contents_len;
- char *fname = NULL, *error = NULL, *base = ZSTR_VAL(p_obj->base), *save = NULL, *temp = NULL;
- char *fname, *error = NULL, *base = p_obj->base ? ZSTR_VAL(p_obj->base) : NULL, *save = NULL, *temp = NULL;
++ char *fname = NULL, *error = NULL, *base = p_obj->base ? ZSTR_VAL(p_obj->base) : NULL, *save = NULL, *temp = NULL;
zend_string *opened;
char *str_key;
zend_class_entry *ce = p_obj->c;