Skip to content

Commit 3ad2f2f

Browse files
committed
ext/phar: refactor phar_build_entry_data() to use a zend_string* for fname
1 parent 3aafc64 commit 3ad2f2f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

ext/phar/phar_object.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,7 @@ static zend_always_inline void phar_call_method_with_unwrap(zend_object *obj, co
13461346
}
13471347

13481348
/* This is the same as phar_get_or_create_entry_data(), but allows overriding metadata via SplFileInfo. */
1349-
static phar_entry_data *phar_build_entry_data(char *fname, size_t fname_len, char *path, size_t path_len, char **error, zval *file_info)
1349+
static phar_entry_data *phar_build_entry_data(zend_string *fname, char *path, size_t path_len, char **error, zval *file_info)
13501350
{
13511351
uint32_t timestamp;
13521352

@@ -1372,7 +1372,7 @@ static phar_entry_data *phar_build_entry_data(char *fname, size_t fname_len, cha
13721372
timestamp = time(NULL);
13731373
}
13741374

1375-
return phar_get_or_create_entry_data(fname, fname_len, path, path_len, "w+b", 0, error, true, timestamp);
1375+
return phar_get_or_create_entry_data(ZSTR_VAL(fname), ZSTR_LEN(fname), path, path_len, "w+b", 0, error, true, timestamp);
13761376
}
13771377

13781378
static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
@@ -1635,7 +1635,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
16351635
return ZEND_HASH_APPLY_KEEP;
16361636
}
16371637

1638-
data = phar_build_entry_data(ZSTR_VAL(phar_obj->archive->fname), ZSTR_LEN(phar_obj->archive->fname), str_key, str_key_len, &error, value);
1638+
data = phar_build_entry_data(phar_obj->archive->fname, str_key, str_key_len, &error, value);
16391639
if (!data) {
16401640
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Entry %s cannot be created: %s", str_key, error);
16411641
efree(error);

0 commit comments

Comments
 (0)