Skip to content

Commit

Permalink
Add phar support for 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
crazywhalecc authored and dixyes committed Jun 2, 2024
1 parent c4aa10d commit 7b3512c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion patches/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

名称 Name | 平台 Platform | 可选? Optional? | 用途 Usage
--- | --- | --- | ---
phar.patch | * | 可选 Optional | 允许micro使用压缩phar Allow micro use compressed phar
phar_\<php version\>.patch | * | 可选 Optional | 允许micro使用压缩phar Allow micro use compressed phar
static_opcache_\<php version\>.patch | * | 可选 Optional | 支持静态构建opcache Support build opcache statically
macos_iconv.patch | macOS | 可选 Optional | 支持链接到系统的iconv Support link against system iconv
static_extensions_win32_\<php version\>.patch | Windows | 可选 Optional | 支持静态构建Windows其他扩展 Support build other extensions for windows
Expand Down
22 changes: 22 additions & 0 deletions patches/phar_80.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index 2403d77a..c908a1b4 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -3309,6 +3309,8 @@ static zend_string *phar_resolve_path(const char *filename, size_t filename_len)
return phar_find_in_include_path((char *) filename, filename_len, NULL);
}

+char *micro_get_filename(void);
+
static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type) /* {{{ */
{
zend_op_array *res;
@@ -3319,7 +3321,7 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type)
if (!file_handle || !file_handle->filename) {
return phar_orig_compile_file(file_handle, type);
}
- if (strstr(file_handle->filename, ".phar") && !strstr(file_handle->filename, "://")) {
+ if ((strstr(file_handle->filename, micro_get_filename()) || strstr(file_handle->filename, ".phar")) && !strstr(file_handle->filename, "://")) {
if (SUCCESS == phar_open_from_filename((char*)file_handle->filename, strlen(file_handle->filename), NULL, 0, 0, &phar, NULL)) {
if (phar->is_zip || phar->is_tar) {
zend_file_handle f = *file_handle;
File renamed without changes.

0 comments on commit 7b3512c

Please sign in to comment.