Skip to content

ext/phar: use zend_string* instead of a char* + size_t pair#21827

Draft
Girgias wants to merge 11 commits intophp:masterfrom
Girgias:2026-04-phar-zend_string_instead_of_char_size_t_pair
Draft

ext/phar: use zend_string* instead of a char* + size_t pair#21827
Girgias wants to merge 11 commits intophp:masterfrom
Girgias:2026-04-phar-zend_string_instead_of_char_size_t_pair

Conversation

@Girgias
Copy link
Copy Markdown
Member

@Girgias Girgias commented Apr 22, 2026

Depends on #21823

Commits should be reviewed individually.

This is the first batch of refactorings, as others are "blocked" by the cache list INI setting that should be converted from a char* to zend_string* too.

Comment thread ext/phar/phar_internal.h

entry->inode = (unsigned short) zend_hash_func(tmp, tmp_len);
} else {
entry->inode = (unsigned short) zend_string_hash_func(entry->filename);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noted the shift here as it s not capped to MAXPATHLEN.

Comment thread ext/phar/phar_internal.h
@@ -410,8 +407,8 @@ void phar_destroy_phar_data(phar_archive_data *phar);

ZEND_ATTRIBUTE_NONNULL zend_result phar_postprocess_file(phar_entry_data *idata, uint32_t crc32, char **error, int process_zip);
zend_result phar_open_from_filename(char *fname, size_t fname_len, char *alias, size_t alias_len, uint32_t options, phar_archive_data** pphar, char **error);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it worth using zend_string * as well as its counterpart phar_open_or_create_filename ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants