diff --git a/ext/phar/config.m4 b/ext/phar/config.m4 index b60e121714b..fb5c8ccc573 100644 --- a/ext/phar/config.m4 +++ b/ext/phar/config.m4 @@ -8,6 +8,7 @@ PHP_ARG_WITH(phar-zip, for zip-based phar support, [ --without-phar-zip PHAR: Disable zip-based phar archive support], no, no) if test "$PHP_PHAR" != "no"; then + PHP_NEW_EXTENSION(phar, tar.c zip.c stream.c func_interceptors.c dirstream.c phar.c phar_object.c phar_path_check.c, $ext_shared) AC_MSG_CHECKING([for zip-based phar support]) if test "$PHP_PHAR_ZIP" != "yes"; then AC_MSG_RESULT([yes]) @@ -29,10 +30,10 @@ if test "$PHP_PHAR" != "no"; then lib/zip_unchange_archive.c lib/zip_memdup.c lib/zip_stat_init.c lib/zip_add_dir.c \ lib/zip_error_clear.c lib/zip_file_error_clear.c" AC_DEFINE(HAVE_PHAR_ZIP,1,[ ]) + PHP_ADD_EXTENSION_DEP(phar, zip, false) else AC_MSG_RESULT([no]) fi - PHP_NEW_EXTENSION(phar, tar.c zip.c stream.c func_interceptors.c dirstream.c phar.c phar_object.c phar_path_check.c $PHP_PHAR_SOURCES, $ext_shared) PHP_ADD_BUILD_DIR($ext_builddir/lib, 1) PHP_SUBST(PHAR_SHARED_LIBADD) PHP_ADD_EXTENSION_DEP(phar, zlib, true) diff --git a/ext/phar/func_interceptors.c b/ext/phar/func_interceptors.c index 1935da0085f..c6683d6b6d9 100644 --- a/ext/phar/func_interceptors.c +++ b/ext/phar/func_interceptors.c @@ -366,6 +366,19 @@ skip_phar: return; } +#ifndef S_ISDIR +#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR) +#endif +#ifndef S_ISREG +#define S_ISREG(mode) (((mode)&S_IFMT) == S_IFREG) +#endif +#ifndef S_ISLNK +#define S_ISLNK(mode) (((mode)&S_IFMT) == S_IFLNK) +#endif + +#define S_IXROOT ( S_IXUSR | S_IXGRP | S_IXOTH ) + + #define IS_LINK_OPERATION(__t) ((__t) == FS_TYPE || (__t) == FS_IS_LINK || (__t) == FS_LSTAT) #define IS_EXISTS_CHECK(__t) ((__t) == FS_EXISTS || (__t) == FS_IS_W || (__t) == FS_IS_R || (__t) == FS_IS_X || (__t) == FS_IS_FILE || (__t) == FS_IS_DIR || (__t) == FS_IS_LINK) #define IS_ABLE_CHECK(__t) ((__t) == FS_IS_R || (__t) == FS_IS_W || (__t) == FS_IS_X) @@ -554,7 +567,7 @@ PHPAPI void phar_file_stat(const char *filename, php_stat_len filename_length, i RETURN_FALSE; } - if (!IS_ABSOLUTE_PATH(filename, filename_len)) { + if (!IS_ABSOLUTE_PATH(filename, filename_length)) { char *arch, *entry, *fname; int arch_len, entry_len, fname_len; fname = zend_get_executed_filename(TSRMLS_C);