Skip to content

Commit 06994a4

Browse files
committed
Add ability of alias resolving (it cause problem while work with opcache)
1 parent 865f221 commit 06994a4

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

ext/phar/config.m4

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,7 @@ if test "$PHP_PHAR" != "no"; then
2828
PHP_ADD_EXTENSION_DEP(phar, spl, true)
2929
PHP_ADD_MAKEFILE_FRAGMENT
3030

31+
PHP_INSTALL_HEADERS([ext/phar], [php_phar.h])
32+
3133
PHP_OUTPUT(ext/phar/phar.1 ext/phar/phar.phar.1)
3234
fi

ext/phar/php_phar.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#ifndef PHP_PHAR_H
2323
#define PHP_PHAR_H
2424

25-
#define PHP_PHAR_VERSION "2.0.1"
25+
#define PHP_PHAR_VERSION "2.0.2"
2626

2727
#include "ext/standard/basic_functions.h"
2828
extern zend_module_entry phar_module_entry;
@@ -31,9 +31,12 @@ extern zend_module_entry phar_module_entry;
3131
#ifdef PHP_WIN32
3232
#define PHP_PHAR_API __declspec(dllexport)
3333
#else
34-
#define PHP_PHAR_API
34+
#define PHP_PHAR_API PHPAPI
3535
#endif
3636

37+
#define PHAR_HAVE_RESOLVE_ALIAS
38+
PHP_PHAR_API int phar_resolve_alias(char *alias, int alias_len, char **filename, int *filename_len TSRMLS_DC);
39+
3740
#endif /* PHP_PHAR_H */
3841

3942

ext/phar/util.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,17 @@ phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry,
11851185
}
11861186
/* }}} */
11871187

1188+
PHP_PHAR_API int phar_resolve_alias(char *alias, int alias_len, char **filename, int *filename_len TSRMLS_DC) /* {{{ */ {
1189+
phar_archive_data **fd_ptr;
1190+
if (SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_alias_map), alias, alias_len, (void**)&fd_ptr)) {
1191+
*filename = (*fd_ptr)->fname;
1192+
*filename_len = (*fd_ptr)->fname_len;
1193+
return 1;
1194+
}
1195+
return 0;
1196+
}
1197+
/* }}} */
1198+
11881199
int phar_free_alias(phar_archive_data *phar, char *alias, int alias_len TSRMLS_DC) /* {{{ */
11891200
{
11901201
if (phar->refcount || phar->is_persistent) {

0 commit comments

Comments
 (0)