mirror of
https://github.com/php/php-src.git
synced 2026-04-05 15:12:39 +02:00
more fixes for PHAR_G(cwd)
This commit is contained in:
@@ -2874,6 +2874,21 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} else if (PHAR_G(cwd_init) && !strstr(file_handle->filename, "://")) {
|
||||
if ((name = phar_find_in_include_path((char *) file_handle->filename, strlen(file_handle->filename), NULL TSRMLS_CC))) {
|
||||
zend_file_handle f = *file_handle;
|
||||
if (SUCCESS == phar_orig_zend_open((const char *)name, file_handle TSRMLS_CC)) {
|
||||
efree(name);
|
||||
name = NULL;
|
||||
file_handle->filename = f.filename;
|
||||
if (f.opened_path) {
|
||||
efree(f.opened_path);
|
||||
}
|
||||
file_handle->free_filename = 1;
|
||||
} else {
|
||||
*file_handle = f;
|
||||
}
|
||||
}
|
||||
}
|
||||
zend_try {
|
||||
failed = 0;
|
||||
|
||||
@@ -236,11 +236,20 @@ char *phar_find_in_include_path(char *filename, int filename_len, phar_archive_d
|
||||
efree(entry);
|
||||
try_len = filename_len;
|
||||
test = phar_fix_filepath(estrndup(filename, filename_len), &try_len, 1 TSRMLS_CC);
|
||||
if (zend_hash_exists(&((*pphar)->manifest), test + 1, try_len - 1)) {
|
||||
spprintf(&ret, 0, "phar://%s%s", arch, test);
|
||||
efree(arch);
|
||||
efree(test);
|
||||
return ret;
|
||||
if (*test == '/') {
|
||||
if (zend_hash_exists(&((*pphar)->manifest), test + 1, try_len - 1)) {
|
||||
spprintf(&ret, 0, "phar://%s%s", arch, test);
|
||||
efree(arch);
|
||||
efree(test);
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
if (zend_hash_exists(&((*pphar)->manifest), test, try_len)) {
|
||||
spprintf(&ret, 0, "phar://%s/%s", arch, test);
|
||||
efree(arch);
|
||||
efree(test);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
efree(entry);
|
||||
|
||||
Reference in New Issue
Block a user