Convert char* + size_t parameters to zend_string* in phar_find_in_include_path()

This commit is contained in:
George Peter Banyard 2023-04-05 14:35:22 +01:00
parent 8e51cfe0ae
commit 7d93ef067f
4 changed files with 8 additions and 8 deletions

View File

@ -116,7 +116,7 @@ static zend_string* phar_get_name_for_relative_paths(zend_string *filename, bool
zend_string *name = NULL;
if (using_include_path) {
if (!(name = phar_find_in_include_path(ZSTR_VAL(filename), ZSTR_LEN(filename), NULL))) {
if (!(name = phar_find_in_include_path(filename, NULL))) {
/* this file is not in the phar, use the original path */
efree(arch);
return NULL;

View File

@ -3288,7 +3288,7 @@ zend_op_array *(*phar_orig_compile_file)(zend_file_handle *file_handle, int type
static zend_string *phar_resolve_path(zend_string *filename)
{
zend_string *ret = phar_find_in_include_path(ZSTR_VAL(filename), ZSTR_LEN(filename), NULL);
zend_string *ret = phar_find_in_include_path(filename, NULL);
if (!ret) {
ret = phar_save_resolve_path(filename);
}

View File

@ -547,7 +547,7 @@ char *phar_compress_filter(phar_entry_info * entry, int return_unknown);
/* void phar_remove_virtual_dirs(phar_archive_data *phar, char *filename, size_t filename_len); */
void phar_add_virtual_dirs(phar_archive_data *phar, char *filename, size_t filename_len);
int phar_mount_entry(phar_archive_data *phar, char *filename, size_t filename_len, char *path, size_t path_len);
zend_string *phar_find_in_include_path(char *file, size_t file_len, phar_archive_data **pphar);
zend_string *phar_find_in_include_path(zend_string *file, phar_archive_data **pphar);
char *phar_fix_filepath(char *path, size_t *new_len, int use_cwd);
phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry, char **error);
void phar_parse_metadata_lazy(const char *buffer, phar_metadata_tracker *tracker, uint32_t zip_metadata_len, int persistent);

View File

@ -239,7 +239,7 @@ int phar_mount_entry(phar_archive_data *phar, char *filename, size_t filename_le
}
/* }}} */
zend_string *phar_find_in_include_path(char *filename, size_t filename_len, phar_archive_data **pphar) /* {{{ */
zend_string *phar_find_in_include_path(zend_string *filename, phar_archive_data **pphar) /* {{{ */
{
zend_string *ret;
char *path, *fname, *arch, *entry, *test;
@ -272,7 +272,7 @@ zend_string *phar_find_in_include_path(char *filename, size_t filename_len, phar
efree(entry);
if (*filename == '.') {
if (*ZSTR_VAL(filename) == '.') {
size_t try_len;
if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL)) {
@ -284,8 +284,8 @@ splitted:
*pphar = phar;
}
try_len = filename_len;
test = phar_fix_filepath(estrndup(filename, filename_len), &try_len, 1);
try_len = ZSTR_LEN(filename);
test = phar_fix_filepath(estrndup(ZSTR_VAL(filename), ZSTR_LEN(filename)), &try_len, 1);
if (*test == '/') {
if (zend_hash_str_exists(&(phar->manifest), test + 1, try_len - 1)) {
@ -307,7 +307,7 @@ splitted:
spprintf(&path, MAXPATHLEN + 1 + strlen(PG(include_path)), "phar://%s/%s%c%s", arch, PHAR_G(cwd), DEFAULT_DIR_SEPARATOR, PG(include_path));
efree(arch);
ret = php_resolve_path(filename, filename_len, path);
ret = php_resolve_path(ZSTR_VAL(filename), ZSTR_LEN(filename), path);
efree(path);
if (ret && ZSTR_LEN(ret) > 8 && !strncmp(ZSTR_VAL(ret), "phar://", 7)) {