version 1.1.1.1, 2012/02/21 23:47:59
|
version 1.1.1.2, 2012/05/29 12:34:41
|
Line 1738 static int phar_open_from_fp(php_stream* fp, char *fna
|
Line 1738 static int phar_open_from_fp(php_stream* fp, char *fna
|
static int phar_analyze_path(const char *fname, const char *ext, int ext_len, int for_create TSRMLS_DC) /* {{{ */ |
static int phar_analyze_path(const char *fname, const char *ext, int ext_len, int for_create TSRMLS_DC) /* {{{ */ |
{ |
{ |
php_stream_statbuf ssb; |
php_stream_statbuf ssb; |
char *realpath, old, *a = (char *)(ext + ext_len); | char *realpath; |
| char *filename = estrndup(fname, (ext - fname) + ext_len); |
|
|
old = *a; | if ((realpath = expand_filepath(filename, NULL TSRMLS_CC))) { |
*a = '\0'; | |
| |
if ((realpath = expand_filepath(fname, NULL TSRMLS_CC))) { | |
#ifdef PHP_WIN32 |
#ifdef PHP_WIN32 |
phar_unixify_path_separators(realpath, strlen(realpath)); |
phar_unixify_path_separators(realpath, strlen(realpath)); |
#endif |
#endif |
if (zend_hash_exists(&(PHAR_GLOBALS->phar_fname_map), realpath, strlen(realpath))) { |
if (zend_hash_exists(&(PHAR_GLOBALS->phar_fname_map), realpath, strlen(realpath))) { |
*a = old; |
|
efree(realpath); |
efree(realpath); |
|
efree(filename); |
return SUCCESS; |
return SUCCESS; |
} |
} |
|
|
if (PHAR_G(manifest_cached) && zend_hash_exists(&cached_phars, realpath, strlen(realpath))) { |
if (PHAR_G(manifest_cached) && zend_hash_exists(&cached_phars, realpath, strlen(realpath))) { |
*a = old; |
|
efree(realpath); |
efree(realpath); |
|
efree(filename); |
return SUCCESS; |
return SUCCESS; |
} |
} |
efree(realpath); |
efree(realpath); |
} |
} |
|
|
if (SUCCESS == php_stream_stat_path((char *) fname, &ssb)) { | if (SUCCESS == php_stream_stat_path((char *) filename, &ssb)) { |
*a = old; | |
|
|
|
efree(filename); |
|
|
if (ssb.sb.st_mode & S_IFDIR) { |
if (ssb.sb.st_mode & S_IFDIR) { |
return FAILURE; |
return FAILURE; |
} |
} |
Line 1777 static int phar_analyze_path(const char *fname, const
|
Line 1776 static int phar_analyze_path(const char *fname, const
|
char *slash; |
char *slash; |
|
|
if (!for_create) { |
if (!for_create) { |
*a = old; | efree(filename); |
return FAILURE; |
return FAILURE; |
} |
} |
|
|
slash = (char *) strrchr(fname, '/'); | slash = (char *) strrchr(filename, '/'); |
*a = old; | |
|
|
if (slash) { |
if (slash) { |
old = *slash; |
|
*slash = '\0'; |
*slash = '\0'; |
} |
} |
|
|
if (SUCCESS != php_stream_stat_path((char *) fname, &ssb)) { | if (SUCCESS != php_stream_stat_path((char *) filename, &ssb)) { |
if (slash) { | if (!slash) { |
*slash = old; | if (!(realpath = expand_filepath(filename, NULL TSRMLS_CC))) { |
} else { | efree(filename); |
if (!(realpath = expand_filepath(fname, NULL TSRMLS_CC))) { | |
return FAILURE; |
return FAILURE; |
} |
} |
#ifdef PHP_WIN32 |
#ifdef PHP_WIN32 |
phar_unixify_path_separators(realpath, strlen(realpath)); |
phar_unixify_path_separators(realpath, strlen(realpath)); |
#endif |
#endif |
a = strstr(realpath, fname) + ((ext - fname) + ext_len); | slash = strstr(realpath, filename) + ((ext - fname) + ext_len); |
*a = '\0'; | *slash = '\0'; |
slash = strrchr(realpath, '/'); |
slash = strrchr(realpath, '/'); |
|
|
if (slash) { |
if (slash) { |
*slash = '\0'; |
*slash = '\0'; |
} else { |
} else { |
efree(realpath); |
efree(realpath); |
|
efree(filename); |
return FAILURE; |
return FAILURE; |
} |
} |
|
|
if (SUCCESS != php_stream_stat_path(realpath, &ssb)) { |
if (SUCCESS != php_stream_stat_path(realpath, &ssb)) { |
efree(realpath); |
efree(realpath); |
|
efree(filename); |
return FAILURE; |
return FAILURE; |
} |
} |
|
|
efree(realpath); |
efree(realpath); |
|
|
if (ssb.sb.st_mode & S_IFDIR) { |
if (ssb.sb.st_mode & S_IFDIR) { |
|
efree(filename); |
return SUCCESS; |
return SUCCESS; |
} |
} |
} |
} |
|
|
|
efree(filename); |
return FAILURE; |
return FAILURE; |
} |
} |
|
|
if (slash) { | efree(filename); |
*slash = old; | |
} | |
|
|
if (ssb.sb.st_mode & S_IFDIR) { |
if (ssb.sb.st_mode & S_IFDIR) { |
return SUCCESS; |
return SUCCESS; |
Line 2335 int phar_open_executed_filename(char *alias, int alias
|
Line 2333 int phar_open_executed_filename(char *alias, int alias
|
*error = NULL; |
*error = NULL; |
} |
} |
|
|
fname = zend_get_executed_filename(TSRMLS_C); | fname = (char*)zend_get_executed_filename(TSRMLS_C); |
fname_len = strlen(fname); |
fname_len = strlen(fname); |
|
|
if (phar_open_parsed_phar(fname, fname_len, alias, alias_len, 0, REPORT_ERRORS, NULL, 0 TSRMLS_CC) == SUCCESS) { |
if (phar_open_parsed_phar(fname, fname_len, alias, alias_len, 0, REPORT_ERRORS, NULL, 0 TSRMLS_CC) == SUCCESS) { |
Line 3340 static zend_op_array *phar_compile_file(zend_file_hand
|
Line 3338 static zend_op_array *phar_compile_file(zend_file_hand
|
return phar_orig_compile_file(file_handle, type TSRMLS_CC); |
return phar_orig_compile_file(file_handle, type TSRMLS_CC); |
} |
} |
if (strstr(file_handle->filename, ".phar") && !strstr(file_handle->filename, "://")) { |
if (strstr(file_handle->filename, ".phar") && !strstr(file_handle->filename, "://")) { |
if (SUCCESS == phar_open_from_filename(file_handle->filename, strlen(file_handle->filename), NULL, 0, 0, &phar, NULL TSRMLS_CC)) { | if (SUCCESS == phar_open_from_filename((char*)file_handle->filename, strlen(file_handle->filename), NULL, 0, 0, &phar, NULL TSRMLS_CC)) { |
if (phar->is_zip || phar->is_tar) { |
if (phar->is_zip || phar->is_tar) { |
zend_file_handle f = *file_handle; |
zend_file_handle f = *file_handle; |
|
|
Line 3421 int phar_zend_open(const char *filename, zend_file_han
|
Line 3419 int phar_zend_open(const char *filename, zend_file_han
|
char *fname; |
char *fname; |
int fname_len; |
int fname_len; |
|
|
fname = zend_get_executed_filename(TSRMLS_C); | fname = (char*)zend_get_executed_filename(TSRMLS_C); |
fname_len = strlen(fname); |
fname_len = strlen(fname); |
|
|
if (fname_len > 7 && !strncasecmp(fname, "phar://", 7)) { |
if (fname_len > 7 && !strncasecmp(fname, "phar://", 7)) { |
Line 3669 PHP_MINFO_FUNCTION(phar) /* {{{ */
|
Line 3667 PHP_MINFO_FUNCTION(phar) /* {{{ */
|
php_info_print_table_header(2, "Phar: PHP Archive support", "enabled"); |
php_info_print_table_header(2, "Phar: PHP Archive support", "enabled"); |
php_info_print_table_row(2, "Phar EXT version", PHP_PHAR_VERSION); |
php_info_print_table_row(2, "Phar EXT version", PHP_PHAR_VERSION); |
php_info_print_table_row(2, "Phar API version", PHP_PHAR_API_VERSION); |
php_info_print_table_row(2, "Phar API version", PHP_PHAR_API_VERSION); |
php_info_print_table_row(2, "SVN revision", "$Revision$"); | php_info_print_table_row(2, "SVN revision", "$Id$"); |
php_info_print_table_row(2, "Phar-based phar archives", "enabled"); |
php_info_print_table_row(2, "Phar-based phar archives", "enabled"); |
php_info_print_table_row(2, "Tar-based phar archives", "enabled"); |
php_info_print_table_row(2, "Tar-based phar archives", "enabled"); |
php_info_print_table_row(2, "ZIP-based phar archives", "enabled"); |
php_info_print_table_row(2, "ZIP-based phar archives", "enabled"); |