]> granicus.if.org Git - php/commitdiff
another attempt at fixing mac OS X compile, remove unused obsolete code
authorGreg Beaver <cellog@php.net>
Mon, 14 Apr 2008 04:47:34 +0000 (04:47 +0000)
committerGreg Beaver <cellog@php.net>
Mon, 14 Apr 2008 04:47:34 +0000 (04:47 +0000)
ext/phar/phar.c
ext/phar/phar_internal.h

index 0694f04a77b21513dd2953d178ce84645645652a..85f62b8e176e978ceaba970b19c7fffb318bc0f2 100644 (file)
 #include "func_interceptors.h"
 
 ZEND_DECLARE_MODULE_GLOBALS(phar)
+int phar_has_bz2;
+int phar_has_zlib;
+#if PHP_VERSION_ID >= 50300
+char *(*phar_save_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
+#endif
 
 /**
  * set's phar->is_writeable based on the current INI value
@@ -2663,7 +2668,7 @@ int phar_zend_open(const char *filename, zend_file_handle *handle TSRMLS_DC) /*
 
        /* this code is obsoleted in php 5.3 */
        entry = (char *) filename;
-       if (!IS_ABSOLUTE_PATH(entry, strlen(entry))) {
+       if (!IS_ABSOLUTE_PATH(entry, strlen(entry)) && !strstr(entry, "://")) {
                phar_archive_data **pphar = NULL;
                char *fname;
                int fname_len;
@@ -2696,67 +2701,6 @@ int phar_zend_open(const char *filename, zend_file_handle *handle TSRMLS_DC) /*
                }
                return FAILURE;
        }
-#if HELLY_0
-       if (0 && zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
-               char *fname = NULL;
-               int fname_len;
-
-               fname = zend_get_executed_filename(TSRMLS_C);
-               if (strncasecmp(fname, "phar://", 7)) {
-                       goto skip_phar;
-               }
-               fname_len = strlen(fname);
-               if (SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len TSRMLS_CC)) {
-                       char *name, *old;
-
-                       old = entry;
-                       entry = (char *) filename;
-                       /* include within phar, if :// is not in the url, then prepend phar://<archive>/ */
-                       if (strstr(entry, "://")) {
-                               efree(arch);
-                               efree(old);
-                               goto skip_phar;
-                       }
-                       entry_len = strlen(entry);
-                       if (!IS_ABSOLUTE_PATH(entry, entry_len)) {
-                               phar_archive_data *pphar = NULL;
-                               /* retrieving an include within the current directory, so use this if possible */
-                               if (SUCCESS == (zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), arch, arch_len, (void **) &pphar))) {
-                                       if (!(entry = phar_find_in_include_path(entry, entry_len, &pphar TSRMLS_CC))) {
-                                               /* this file is not in the phar, use the original path */
-                                               if (SUCCESS == phar_orig_zend_open(filename, handle TSRMLS_CC)) {
-                                                       if (SUCCESS == phar_mount_entry(pphar, handle->opened_path ? handle->opened_path : (char *) filename, strlen(handle->opened_path ? handle->opened_path : filename), (char *) filename, strlen(filename) TSRMLS_CC)) {
-                                                               if (handle->opened_path) {
-                                                                       efree(handle->opened_path);
-                                                               }
-                                                               entry = (char *) filename;
-                                                               goto dopharthing;
-                                                       }
-                                               }
-                                               efree(old);
-                                               efree(arch);
-                                               return FAILURE;
-                                       }
-                               }
-                       }
-dopharthing:
-                       efree(old);
-                       /* auto-convert to phar:// */
-                       spprintf(&name, 4096, "phar://%s/%s", arch, entry);
-                       efree(arch);
-                       if (entry != filename) {
-                               efree(entry);
-                       }
-                       if (SUCCESS == phar_orig_zend_open(name, handle TSRMLS_CC)) {
-                               if (!handle->opened_path) {
-                                       handle->opened_path = name;
-                               }
-                               return SUCCESS;
-                       }
-                       return FAILURE;
-               }
-       }
-#endif
 skip_phar:
        return phar_orig_zend_open(filename, handle TSRMLS_CC);
 }
index a68b64667c9143c53672794847812d278b67bd26..6c13c34c95794a09c77a8a358bdc02ecf7d240f6 100755 (executable)
@@ -342,13 +342,16 @@ union _phar_entry_object {
 };
 #endif
 
+#ifndef PHAR_MAIN
+extern int phar_has_bz2;
+extern int phar_has_zlib;
+# if PHP_VERSION_ID >= 50300
+extern char *(*phar_save_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
+# endif
+#endif
+
 BEGIN_EXTERN_C()
 
-int phar_has_bz2;
-int phar_has_zlib;
-#if PHP_VERSION_ID >= 50300
-char *(*phar_save_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
-#endif
 
 #ifdef PHP_WIN32
 char *tsrm_strtok_r(char *s, const char *delim, char **last);