|
37 | 37 | #include "zend_API.h" |
38 | 38 | #include "zend_ini.h" |
39 | 39 | #include "TSRM/tsrm_virtual_cwd.h" |
40 | | -#include "ext/phar/php_phar.h" |
41 | 40 | #include "zend_accelerator_util_funcs.h" |
42 | 41 | #include "zend_accelerator_hash.h" |
43 | 42 |
|
@@ -145,21 +144,6 @@ static inline int is_cacheable_stream_path(const char *filename) |
145 | 144 | memcmp(filename, "phar://", sizeof("phar://") - 1) == 0; |
146 | 145 | } |
147 | 146 |
|
148 | | -static inline int is_phar_relative_alias_path(const char *filename, char **alias, int *alias_len) |
149 | | -{ |
150 | | - if (memcmp(filename, "phar://", sizeof("phar://") - 1) == 0 |
151 | | - && filename[sizeof("phar://") - 1] != '\0' && filename[sizeof("phar://") - 1] != '/') { |
152 | | - char *slash; |
153 | | - *alias = (char*)filename + sizeof("phar://") - 1; |
154 | | - slash = strstr(*alias, "/"); |
155 | | - if (slash) { |
156 | | - *alias_len = slash - *alias; |
157 | | - return 1; |
158 | | - } |
159 | | - } |
160 | | - return 0; |
161 | | -} |
162 | | - |
163 | 147 | /* O+ overrides PHP chdir() function and remembers the current working directory |
164 | 148 | * in ZCG(cwd) and ZCG(cwd_len). Later accel_getcwd() can use stored value and |
165 | 149 | * avoid getcwd() call. |
@@ -1044,33 +1028,15 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt |
1044 | 1028 | } |
1045 | 1029 | memcpy(ZCG(key) + cur_len, include_path, include_path_len); |
1046 | 1030 | ZCG(key)[key_length] = '\0'; |
1047 | | - } else { |
1048 | | - /* not use_cwd */ |
1049 | | - key_length = path_length; |
| 1031 | + } else { |
| 1032 | + /* not use_cwd */ |
| 1033 | + key_length = path_length; |
1050 | 1034 | if ((size_t)key_length >= sizeof(ZCG(key))) { |
1051 | 1035 | ZCG(key_len) = 0; |
1052 | 1036 | return NULL; |
1053 | | - } else { |
1054 | | - char *alias; |
1055 | | - int alias_len; |
1056 | | - if (is_phar_relative_alias_path(file_handle->filename, &alias, &alias_len)) { |
1057 | | - char *phar_path; |
1058 | | - int phar_path_len; |
1059 | | - if (phar_resolve_alias(alias, alias_len, &phar_path, &phar_path_len TSRMLS_CC) == SUCCESS) { |
1060 | | - int filename_len = strlen(file_handle->filename); |
1061 | | - memcpy(ZCG(key), "phar://", sizeof("phar://") -1); |
1062 | | - memcpy(ZCG(key) + sizeof("phar://") - 1, phar_path, phar_path_len); |
1063 | | - memcpy(ZCG(key) + sizeof("phar://") - 1 + phar_path_len, |
1064 | | - alias + alias_len, filename_len - alias_len - sizeof("phar://") + 2); |
1065 | | - key_length = filename_len + (phar_path_len - alias_len); |
1066 | | - } else { |
1067 | | - memcpy(ZCG(key), file_handle->filename, key_length + 1); |
1068 | | - } |
1069 | | - } else { |
1070 | | - memcpy(ZCG(key), file_handle->filename, key_length + 1); |
1071 | | - } |
1072 | 1037 | } |
1073 | | - } |
| 1038 | + memcpy(ZCG(key), file_handle->filename, key_length + 1); |
| 1039 | + } |
1074 | 1040 |
|
1075 | 1041 | *key_len = ZCG(key_len) = key_length; |
1076 | 1042 | return ZCG(key); |
|
0 commit comments