Skip to content

Commit 9d75b9f

Browse files
committed
Revert "Fixed issue #115 (path issue when using phar)."
We need another better way to fix this This reverts commit 0988554. Conflicts: ext/opcache/ZendAccelerator.c
1 parent 63dba7e commit 9d75b9f

File tree

2 files changed

+5
-40
lines changed

2 files changed

+5
-40
lines changed

NEWS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ PHP NEWS
7575
imap). (ryotakatsuki at gmail dot com)
7676

7777
- OPcache:
78-
. Fixed issue #115 (path issue when using phar). (Laruence)
7978
. Added support for GNU Hurd. (Svante Signell)
8079
. Added function opcache_compile_file() to load PHP scripts into cache
8180
without execution. (Julien)

ext/opcache/ZendAccelerator.c

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#include "zend_API.h"
3838
#include "zend_ini.h"
3939
#include "TSRM/tsrm_virtual_cwd.h"
40-
#include "ext/phar/php_phar.h"
4140
#include "zend_accelerator_util_funcs.h"
4241
#include "zend_accelerator_hash.h"
4342

@@ -145,21 +144,6 @@ static inline int is_cacheable_stream_path(const char *filename)
145144
memcmp(filename, "phar://", sizeof("phar://") - 1) == 0;
146145
}
147146

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-
163147
/* O+ overrides PHP chdir() function and remembers the current working directory
164148
* in ZCG(cwd) and ZCG(cwd_len). Later accel_getcwd() can use stored value and
165149
* avoid getcwd() call.
@@ -1044,33 +1028,15 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt
10441028
}
10451029
memcpy(ZCG(key) + cur_len, include_path, include_path_len);
10461030
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;
10501034
if ((size_t)key_length >= sizeof(ZCG(key))) {
10511035
ZCG(key_len) = 0;
10521036
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-
}
10721037
}
1073-
}
1038+
memcpy(ZCG(key), file_handle->filename, key_length + 1);
1039+
}
10741040

10751041
*key_len = ZCG(key_len) = key_length;
10761042
return ZCG(key);

0 commit comments

Comments
 (0)