From: Xinchen Hui Date: Thu, 17 Oct 2013 04:23:09 +0000 (+0800) Subject: Add ability of alias resolving (it cause problem while work with opcache) X-Git-Tag: php-5.5.6RC1~5^2~36 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06994a419d625291c2ae071e3b22716901b45cf6;p=php Add ability of alias resolving (it cause problem while work with opcache) --- diff --git a/ext/phar/config.m4 b/ext/phar/config.m4 index d424060f2a..614d672eab 100644 --- a/ext/phar/config.m4 +++ b/ext/phar/config.m4 @@ -28,5 +28,7 @@ if test "$PHP_PHAR" != "no"; then PHP_ADD_EXTENSION_DEP(phar, spl, true) PHP_ADD_MAKEFILE_FRAGMENT + PHP_INSTALL_HEADERS([ext/phar], [php_phar.h]) + PHP_OUTPUT(ext/phar/phar.1 ext/phar/phar.phar.1) fi diff --git a/ext/phar/php_phar.h b/ext/phar/php_phar.h index a6d7bff414..4146e28f77 100644 --- a/ext/phar/php_phar.h +++ b/ext/phar/php_phar.h @@ -22,7 +22,7 @@ #ifndef PHP_PHAR_H #define PHP_PHAR_H -#define PHP_PHAR_VERSION "2.0.1" +#define PHP_PHAR_VERSION "2.0.2" #include "ext/standard/basic_functions.h" extern zend_module_entry phar_module_entry; @@ -31,9 +31,12 @@ extern zend_module_entry phar_module_entry; #ifdef PHP_WIN32 #define PHP_PHAR_API __declspec(dllexport) #else -#define PHP_PHAR_API +#define PHP_PHAR_API PHPAPI #endif +#define PHAR_HAVE_RESOLVE_ALIAS +PHP_PHAR_API int phar_resolve_alias(char *alias, int alias_len, char **filename, int *filename_len TSRMLS_DC); + #endif /* PHP_PHAR_H */ diff --git a/ext/phar/util.c b/ext/phar/util.c index 8348a47874..e9f1b1673c 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -1185,6 +1185,17 @@ phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry, } /* }}} */ +PHP_PHAR_API int phar_resolve_alias(char *alias, int alias_len, char **filename, int *filename_len TSRMLS_DC) /* {{{ */ { + phar_archive_data **fd_ptr; + if (SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_alias_map), alias, alias_len, (void**)&fd_ptr)) { + *filename = (*fd_ptr)->fname; + *filename_len = (*fd_ptr)->fname_len; + return 1; + } + return 0; +} +/* }}} */ + int phar_free_alias(phar_archive_data *phar, char *alias, int alias_len TSRMLS_DC) /* {{{ */ { if (phar->refcount || phar->is_persistent) {