]> granicus.if.org Git - php/commitdiff
Add ability of alias resolving (it cause problem while work with opcache)
authorXinchen Hui <laruence@php.net>
Thu, 17 Oct 2013 04:23:09 +0000 (12:23 +0800)
committerXinchen Hui <laruence@php.net>
Thu, 17 Oct 2013 04:23:09 +0000 (12:23 +0800)
ext/phar/config.m4
ext/phar/php_phar.h
ext/phar/util.c

index d424060f2a247f9c88f700fe5b125960e3570c27..614d672eabd9d165005e0d42fee02d8c264354f4 100644 (file)
@@ -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
index a6d7bff414b8c0d45c07bc395858bc2508cb6acd..4146e28f770da7d93f5c041535d0d03800429770 100644 (file)
@@ -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 */
 
 
index 8348a47874eab369f3d79ab67bb78a08211b21ce..e9f1b1673c32461ca91906e456c3f6af3d84a7d6 100644 (file)
@@ -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) {