summaryrefslogtreecommitdiff
path: root/ext/phar
diff options
context:
space:
mode:
Diffstat (limited to 'ext/phar')
-rw-r--r--ext/phar/func_interceptors.c30
-rw-r--r--ext/phar/phar.c50
-rw-r--r--ext/phar/phar_internal.h6
-rw-r--r--ext/phar/phar_object.c22
-rw-r--r--ext/phar/phar_path_check.c2
-rw-r--r--ext/phar/stream.c2
-rw-r--r--ext/phar/tests/fatal_error_webphar.phpt2
-rw-r--r--ext/phar/tests/fgc_edgecases.phpt26
-rw-r--r--ext/phar/tests/files/stuboflength1041.phar.inc21
-rw-r--r--ext/phar/tests/fopen_edgecases2.phpt2
-rw-r--r--ext/phar/tests/opendir_edgecases.phpt4
-rw-r--r--ext/phar/tests/phar_gobyebye.phpt2
-rw-r--r--ext/phar/tests/phar_mount.phpt2
-rw-r--r--ext/phar/tests/phpinfo_003.phpt2
-rw-r--r--ext/phar/tests/readfile_edgecases.phpt4
-rw-r--r--ext/phar/tests/zip/notphar.phpt1
-rw-r--r--ext/phar/util.c9
17 files changed, 82 insertions, 105 deletions
diff --git a/ext/phar/func_interceptors.c b/ext/phar/func_interceptors.c
index 2e0739ea57..55f2548859 100644
--- a/ext/phar/func_interceptors.c
+++ b/ext/phar/func_interceptors.c
@@ -38,14 +38,14 @@ PHAR_FUNC(phar_opendir) /* {{{ */
goto skip_phar;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &filename, &filename_len, &zcontext) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|z", &filename, &filename_len, &zcontext) == FAILURE) {
return;
}
if (!IS_ABSOLUTE_PATH(filename, filename_len) && !strstr(filename, "://")) {
char *arch, *entry, *fname;
int arch_len, entry_len, fname_len;
- fname = zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename(TSRMLS_C);
/* we are checking for existence of a file within the relative path. Chances are good that this is
retrieving something from within the phar archive */
@@ -113,7 +113,7 @@ PHAR_FUNC(phar_file_get_contents) /* {{{ */
}
/* Parse arguments */
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|br!ll", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p|br!ll", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) {
goto skip_phar;
}
@@ -122,7 +122,7 @@ PHAR_FUNC(phar_file_get_contents) /* {{{ */
int arch_len, entry_len, fname_len;
php_stream_context *context = NULL;
- fname = zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename(TSRMLS_C);
if (strncasecmp(fname, "phar://", 7)) {
goto skip_phar;
@@ -203,7 +203,7 @@ phar_it:
/* uses mmap if possible */
if ((len = php_stream_copy_to_mem(stream, &contents, maxlen, 0)) > 0) {
-#if PHP_MAJOR_VERSION < 6
+#if PHP_API_VERSION < 20100412
if (PG(magic_quotes_runtime)) {
int newlen;
contents = php_addslashes(contents, len, &newlen, 1 TSRMLS_CC); /* 1 = free source string */
@@ -244,7 +244,7 @@ PHAR_FUNC(phar_readfile) /* {{{ */
&& !cached_phars.arBuckets) {
goto skip_phar;
}
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|br!", &filename, &filename_len, &use_include_path, &zcontext) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p|br!", &filename, &filename_len, &use_include_path, &zcontext) == FAILURE) {
goto skip_phar;
}
if (use_include_path || (!IS_ABSOLUTE_PATH(filename, filename_len) && !strstr(filename, "://"))) {
@@ -253,7 +253,7 @@ PHAR_FUNC(phar_readfile) /* {{{ */
php_stream_context *context = NULL;
char *name;
phar_archive_data *phar;
- fname = zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename(TSRMLS_C);
if (strncasecmp(fname, "phar://", 7)) {
goto skip_phar;
@@ -340,7 +340,7 @@ PHAR_FUNC(phar_fopen) /* {{{ */
/* no need to check, include_path not even specified in fopen/ no active phars */
goto skip_phar;
}
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ss|br", &filename, &filename_len, &mode, &mode_len, &use_include_path, &zcontext) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ps|br", &filename, &filename_len, &mode, &mode_len, &use_include_path, &zcontext) == FAILURE) {
goto skip_phar;
}
if (use_include_path || (!IS_ABSOLUTE_PATH(filename, filename_len) && !strstr(filename, "://"))) {
@@ -349,7 +349,7 @@ PHAR_FUNC(phar_fopen) /* {{{ */
php_stream_context *context = NULL;
char *name;
phar_archive_data *phar;
- fname = zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename(TSRMLS_C);
if (strncasecmp(fname, "phar://", 7)) {
goto skip_phar;
@@ -621,7 +621,7 @@ static void phar_file_stat(const char *filename, php_stat_len filename_length, i
phar_entry_info *data = NULL;
phar_archive_data *phar;
- fname = zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename(TSRMLS_C);
/* we are checking for existence of a file within the relative path. Chances are good that this is
retrieving something from within the phar archive */
@@ -813,7 +813,7 @@ void fname(INTERNAL_FUNCTION_PARAMETERS) { \
char *filename; \
int filename_len; \
\
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { \
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { \
return; \
} \
\
@@ -905,13 +905,13 @@ PHAR_FUNC(phar_is_file) /* {{{ */
&& !cached_phars.arBuckets) {
goto skip_phar;
}
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) {
goto skip_phar;
}
if (!IS_ABSOLUTE_PATH(filename, filename_len) && !strstr(filename, "://")) {
char *arch, *entry, *fname;
int arch_len, entry_len, fname_len;
- fname = zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename(TSRMLS_C);
/* we are checking for existence of a file within the relative path. Chances are good that this is
retrieving something from within the phar archive */
@@ -972,13 +972,13 @@ PHAR_FUNC(phar_is_link) /* {{{ */
&& !cached_phars.arBuckets) {
goto skip_phar;
}
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) {
goto skip_phar;
}
if (!IS_ABSOLUTE_PATH(filename, filename_len) && !strstr(filename, "://")) {
char *arch, *entry, *fname;
int arch_len, entry_len, fname_len;
- fname = zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename(TSRMLS_C);
/* we are checking for existence of a file within the relative path. Chances are good that this is
retrieving something from within the phar archive */
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index d8eaad1a24..2a47d3d035 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -1738,31 +1738,30 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a
static int phar_analyze_path(const char *fname, const char *ext, int ext_len, int for_create TSRMLS_DC) /* {{{ */
{
php_stream_statbuf ssb;
- char *realpath, old, *a = (char *)(ext + ext_len);
+ char *realpath;
+ char *filename = estrndup(fname, (ext - fname) + ext_len);
- old = *a;
- *a = '\0';
-
- if ((realpath = expand_filepath(fname, NULL TSRMLS_CC))) {
+ if ((realpath = expand_filepath(filename, NULL TSRMLS_CC))) {
#ifdef PHP_WIN32
phar_unixify_path_separators(realpath, strlen(realpath));
#endif
if (zend_hash_exists(&(PHAR_GLOBALS->phar_fname_map), realpath, strlen(realpath))) {
- *a = old;
efree(realpath);
+ efree(filename);
return SUCCESS;
}
if (PHAR_G(manifest_cached) && zend_hash_exists(&cached_phars, realpath, strlen(realpath))) {
- *a = old;
efree(realpath);
+ efree(filename);
return SUCCESS;
}
efree(realpath);
}
- if (SUCCESS == php_stream_stat_path((char *) fname, &ssb)) {
- *a = old;
+ if (SUCCESS == php_stream_stat_path((char *) filename, &ssb)) {
+
+ efree(filename);
if (ssb.sb.st_mode & S_IFDIR) {
return FAILURE;
@@ -1777,57 +1776,56 @@ static int phar_analyze_path(const char *fname, const char *ext, int ext_len, in
char *slash;
if (!for_create) {
- *a = old;
+ efree(filename);
return FAILURE;
}
- slash = (char *) strrchr(fname, '/');
- *a = old;
+ slash = (char *) strrchr(filename, '/');
if (slash) {
- old = *slash;
*slash = '\0';
}
- if (SUCCESS != php_stream_stat_path((char *) fname, &ssb)) {
- if (slash) {
- *slash = old;
- } else {
- if (!(realpath = expand_filepath(fname, NULL TSRMLS_CC))) {
+ if (SUCCESS != php_stream_stat_path((char *) filename, &ssb)) {
+ if (!slash) {
+ if (!(realpath = expand_filepath(filename, NULL TSRMLS_CC))) {
+ efree(filename);
return FAILURE;
}
#ifdef PHP_WIN32
phar_unixify_path_separators(realpath, strlen(realpath));
#endif
- a = strstr(realpath, fname) + ((ext - fname) + ext_len);
- *a = '\0';
+ slash = strstr(realpath, filename) + ((ext - fname) + ext_len);
+ *slash = '\0';
slash = strrchr(realpath, '/');
if (slash) {
*slash = '\0';
} else {
efree(realpath);
+ efree(filename);
return FAILURE;
}
if (SUCCESS != php_stream_stat_path(realpath, &ssb)) {
efree(realpath);
+ efree(filename);
return FAILURE;
}
efree(realpath);
if (ssb.sb.st_mode & S_IFDIR) {
+ efree(filename);
return SUCCESS;
}
}
+ efree(filename);
return FAILURE;
}
- if (slash) {
- *slash = old;
- }
+ efree(filename);
if (ssb.sb.st_mode & S_IFDIR) {
return SUCCESS;
@@ -2335,7 +2333,7 @@ int phar_open_executed_filename(char *alias, int alias_len, char **error TSRMLS_
*error = NULL;
}
- fname = zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename(TSRMLS_C);
fname_len = strlen(fname);
if (phar_open_parsed_phar(fname, fname_len, alias, alias_len, 0, REPORT_ERRORS, NULL, 0 TSRMLS_CC) == SUCCESS) {
@@ -3340,7 +3338,7 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type
return phar_orig_compile_file(file_handle, type TSRMLS_CC);
}
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) {
zend_file_handle f = *file_handle;
@@ -3421,7 +3419,7 @@ int phar_zend_open(const char *filename, zend_file_handle *handle TSRMLS_DC) /*
char *fname;
int fname_len;
- fname = zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename(TSRMLS_C);
fname_len = strlen(fname);
if (fname_len > 7 && !strncasecmp(fname, "phar://", 7)) {
diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h
index bd50bb9995..38342e3f7e 100644
--- a/ext/phar/phar_internal.h
+++ b/ext/phar/phar_internal.h
@@ -485,9 +485,9 @@ typedef struct _phar_entry_data {
off_t position;
/* for copies of the phar fp, defines where 0 is */
off_t zero;
- int for_write:1;
- int is_zip:1;
- int is_tar:1;
+ unsigned int for_write:1;
+ unsigned int is_zip:1;
+ unsigned int is_tar:1;
phar_entry_info *internal_file;
} phar_entry_data;
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index 0335615ea4..de9fffc115 100644
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -257,7 +257,8 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char
static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char *mime_type, int code, char *entry, int entry_len, char *arch, char *basename, char *ru, int ru_len TSRMLS_DC) /* {{{ */
{
- char *name = NULL, buf[8192], *cwd;
+ char *name = NULL, buf[8192];
+ const char *cwd;
zend_syntax_highlighter_ini syntax_highlighter_ini;
sapi_header_line ctr = {0};
size_t got;
@@ -540,7 +541,7 @@ PHP_METHOD(Phar, running)
return;
}
- fname = zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename(TSRMLS_C);
fname_len = strlen(fname);
if (fname_len > 7 && !memcmp(fname, "phar://", 7) && SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0 TSRMLS_CC)) {
@@ -574,7 +575,7 @@ PHP_METHOD(Phar, mount)
return;
}
- fname = zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename(TSRMLS_C);
fname_len = strlen(fname);
#ifdef PHP_WIN32
@@ -658,7 +659,8 @@ PHP_METHOD(Phar, webPhar)
zval *mimeoverride = NULL, *rewrite = NULL;
char *alias = NULL, *error, *index_php = NULL, *f404 = NULL, *ru = NULL;
int alias_len = 0, ret, f404_len = 0, free_pathinfo = 0, ru_len = 0;
- char *fname, *basename, *path_info, *mime_type = NULL, *entry, *pt;
+ char *fname, *path_info, *mime_type = NULL, *entry, *pt;
+ const char *basename;
int fname_len, entry_len, code, index_php_len = 0, not_cgi;
phar_archive_data *phar = NULL;
phar_entry_info *info = NULL;
@@ -668,7 +670,7 @@ PHP_METHOD(Phar, webPhar)
}
phar_request_initialize(TSRMLS_C);
- fname = zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename(TSRMLS_C);
fname_len = strlen(fname);
if (phar_open_executed_filename(alias, alias_len, &error TSRMLS_CC) != SUCCESS) {
@@ -934,7 +936,7 @@ PHP_METHOD(Phar, webPhar)
}
if (mimeoverride && zend_hash_num_elements(Z_ARRVAL_P(mimeoverride))) {
- char *ext = zend_memrchr(entry, '.', entry_len);
+ const char *ext = zend_memrchr(entry, '.', entry_len);
zval **val;
if (ext) {
@@ -1480,7 +1482,7 @@ PHP_METHOD(Phar, unlinkArchive)
return;
}
- zname = zend_get_executed_filename(TSRMLS_C);
+ zname = (char*)zend_get_executed_filename(TSRMLS_C);
zname_len = strlen(zname);
if (zname_len > 7 && !memcmp(zname, "phar://", 7) && SUCCESS == phar_split_fname(zname, zname_len, &arch, &arch_len, &entry, &entry_len, 2, 0 TSRMLS_CC)) {
@@ -2201,7 +2203,8 @@ static int phar_copy_file_contents(phar_entry_info *entry, php_stream *fp TSRMLS
static zval *phar_rename_archive(phar_archive_data *phar, char *ext, zend_bool compress TSRMLS_DC) /* {{{ */
{
- char *oldname = NULL, *oldpath = NULL;
+ const char *oldname = NULL;
+ char *oldpath = NULL;
char *basename = NULL, *basepath = NULL;
char *newname = NULL, *newpath = NULL;
zval *ret, arg1;
@@ -4296,7 +4299,8 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
php_stream_statbuf ssb;
int len;
php_stream *fp;
- char *fullpath, *slash;
+ char *fullpath;
+ const char *slash;
mode_t mode;
if (entry->is_mounted) {
diff --git a/ext/phar/phar_path_check.c b/ext/phar/phar_path_check.c
index 01e8c79fe8..7ca339d269 100644
--- a/ext/phar/phar_path_check.c
+++ b/ext/phar/phar_path_check.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Fri Feb 25 04:29:05 2011 */
+/* Generated by re2c 0.13.5 on Fri Feb 25 04:35:39 2011 */
#line 1 "ext/phar/phar_path_check.re"
/*
+----------------------------------------------------------------------+
diff --git a/ext/phar/stream.c b/ext/phar/stream.c
index 7e74ed60f3..2f72551262 100644
--- a/ext/phar/stream.c
+++ b/ext/phar/stream.c
@@ -421,7 +421,7 @@ static int phar_stream_seek(php_stream *stream, off_t offset, int whence, off_t
case SEEK_SET :
temp = data->zero + offset;
break;
- default :
+ default:
temp = 0;
}
if (temp > data->zero + (off_t) entry->uncompressed_filesize) {
diff --git a/ext/phar/tests/fatal_error_webphar.phpt b/ext/phar/tests/fatal_error_webphar.phpt
index 80efaa9ed1..3153c344e0 100644
--- a/ext/phar/tests/fatal_error_webphar.phpt
+++ b/ext/phar/tests/fatal_error_webphar.phpt
@@ -15,4 +15,4 @@ Content-type: text/html; charset=UTF-8
--EXPECTF--
string(9) "\Web\View"
-Parse error: syntax error, unexpected T_ECHO, expecting T_FUNCTION in phar://%sfatal_error_webphar.php/Web/View.php on line 380 \ No newline at end of file
+Parse error: syntax error, unexpected %s, expecting %s in phar:///%sfatal_error_webphar.php/Web/View.php on line 380
diff --git a/ext/phar/tests/fgc_edgecases.phpt b/ext/phar/tests/fgc_edgecases.phpt
index 5b85d0dcf2..2699834eb0 100644
--- a/ext/phar/tests/fgc_edgecases.phpt
+++ b/ext/phar/tests/fgc_edgecases.phpt
@@ -33,7 +33,6 @@ echo file_get_contents("foob", true);
echo file_get_contents("./hi", 0, $context);
echo file_get_contents("../oops");
echo file_get_contents("./hi", 0, $context, 50000);
-ini_set("magic_quotes_runtime", 1);
echo file_get_contents("./hi");
echo file_get_contents("./hi", 0, $context, 0, 0);
?>
@@ -48,7 +47,7 @@ include $pname . '/foo/hi';
<?php rmdir(dirname(__FILE__) . '/poo'); ?>
<?php unlink(dirname(__FILE__) . '/foob'); ?>
--EXPECTF--
-Warning: file_get_contents() expects parameter 1 to be string, array given in %sfgc_edgecases.php on line %d
+Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %sfgc_edgecases.php on line %d
blah
<?php
echo file_get_contents("foo/" . basename(__FILE__));
@@ -60,7 +59,6 @@ echo file_get_contents("foob", true);
echo file_get_contents("./hi", 0, $context);
echo file_get_contents("../oops");
echo file_get_contents("./hi", 0, $context, 50000);
-ini_set("magic_quotes_runtime", 1);
echo file_get_contents("./hi");
echo file_get_contents("./hi", 0, $context, 0, 0);
?>
@@ -78,7 +76,6 @@ echo file_get_contents("foob", true);
echo file_get_contents("./hi", 0, $context);
echo file_get_contents("../oops");
echo file_get_contents("./hi", 0, $context, 50000);
-ini_set("magic_quotes_runtime", 1);
echo file_get_contents("./hi");
echo file_get_contents("./hi", 0, $context, 0, 0);
?>
@@ -87,17 +84,16 @@ Warning: file_get_contents(phar://%sfgc_edgecases.phar.php/oops): failed to open
Warning: file_get_contents(): Failed to seek to position 50000 in the stream in phar://%sfgc_edgecases.phar.php/foo/hi on line %d
<?php
-echo file_get_contents(\"foo/\" . basename(__FILE__));
+echo file_get_contents("foo/" . basename(__FILE__));
$context = stream_context_create();
-file_get_contents(\"./hi\", 0, $context, 0, -1);
-echo file_get_contents(\"foob\");
-set_include_path(\"%stests\");
-echo file_get_contents(\"foob\", true);
-echo file_get_contents(\"./hi\", 0, $context);
-echo file_get_contents(\"../oops\");
-echo file_get_contents(\"./hi\", 0, $context, 50000);
-ini_set(\"magic_quotes_runtime\", 1);
-echo file_get_contents(\"./hi\");
-echo file_get_contents(\"./hi\", 0, $context, 0, 0);
+file_get_contents("./hi", 0, $context, 0, -1);
+echo file_get_contents("foob");
+set_include_path("%stests");
+echo file_get_contents("foob", true);
+echo file_get_contents("./hi", 0, $context);
+echo file_get_contents("../oops");
+echo file_get_contents("./hi", 0, $context, 50000);
+echo file_get_contents("./hi");
+echo file_get_contents("./hi", 0, $context, 0, 0);
?>
===DONE===
diff --git a/ext/phar/tests/files/stuboflength1041.phar.inc b/ext/phar/tests/files/stuboflength1041.phar.inc
index 4a26a41a09..28ce8427f3 100644
--- a/ext/phar/tests/files/stuboflength1041.phar.inc
+++ b/ext/phar/tests/files/stuboflength1041.phar.inc
@@ -18,25 +18,4 @@ $phar->setStub('<?php
************************************************************************************************
************************************************************************************************
*********************************************/
-__HALT_COMPILER();');
-<?php
-
-@unlink(__DIR__ . '/stuboflength1041.phar');
-
-$phar = new Phar('./stuboflength1041.phar');
-$phar['a.php'] = 'hi1';
-$phar['b.php'] = 'hi2';
-
-$phar->setStub('<?php
-/***stub of length 1041 including the halt compiler*********************************************
-************************************************************************************************
-************************************************************************************************
-************************************************************************************************
-************************************************************************************************
-************************************************************************************************
-************************************************************************************************
-************************************************************************************************
-************************************************************************************************
-************************************************************************************************
-*********************************************/
__HALT_COMPILER();'); \ No newline at end of file
diff --git a/ext/phar/tests/fopen_edgecases2.phpt b/ext/phar/tests/fopen_edgecases2.phpt
index c7ccd34afe..d55c97d228 100644
--- a/ext/phar/tests/fopen_edgecases2.phpt
+++ b/ext/phar/tests/fopen_edgecases2.phpt
@@ -36,7 +36,7 @@ include $pname . '/foo/hi';
<?php rmdir(dirname(__FILE__) . '/poo'); ?>
<?php unlink(dirname(__FILE__) . '/foob'); ?>
--EXPECTF--
-Warning: fopen() expects parameter 1 to be string, array given in %sfopen_edgecases2.php on line %d
+Warning: fopen() expects parameter 1 to be a valid path, array given in %sfopen_edgecases2.php on line %d
blah
test
diff --git a/ext/phar/tests/opendir_edgecases.phpt b/ext/phar/tests/opendir_edgecases.phpt
index c0f5ebc067..be899df81b 100644
--- a/ext/phar/tests/opendir_edgecases.phpt
+++ b/ext/phar/tests/opendir_edgecases.phpt
@@ -52,10 +52,10 @@ include $pname . '/foo';
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php rmdir(dirname(__FILE__) . '/poo');
--EXPECTF--
-Warning: opendir() expects parameter 1 to be %string, array given in %sopendir_edgecases.php on line %d
+Warning: opendir() expects parameter 1 to be a valid path, array given in %sopendir_edgecases.php on line %d
.
..
foo
Warning: opendir(phar://%sopendir_edgecases.phar.php/oops): failed to open dir: %s in phar://%sopendir_edgecases.phar.php/foo on line %d
-===DONE=== \ No newline at end of file
+===DONE===
diff --git a/ext/phar/tests/phar_gobyebye.phpt b/ext/phar/tests/phar_gobyebye.phpt
index 608e950768..93e153bdf2 100644
--- a/ext/phar/tests/phar_gobyebye.phpt
+++ b/ext/phar/tests/phar_gobyebye.phpt
@@ -44,4 +44,4 @@ bool(false)
bool(false)
Warning: opendir(foo/hi): failed to open dir: No such file or directory in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
-===DONE=== \ No newline at end of file
+===DONE===
diff --git a/ext/phar/tests/phar_mount.phpt b/ext/phar/tests/phar_mount.phpt
index 80f8cda389..73bd489a2d 100644
--- a/ext/phar/tests/phar_mount.phpt
+++ b/ext/phar/tests/phar_mount.phpt
@@ -60,4 +60,4 @@ Mounting of testit to %sphar_mount.php within phar %sphar_mount.phar.tar failed
Mounting of /oops to /home/oops/../../etc/passwd: within phar %sphar_mount.phar.php failed
<?php
$fname = dirname(__FILE__) . '/' . basename(
-===DONE=== \ No newline at end of file
+===DONE===
diff --git a/ext/phar/tests/phpinfo_003.phpt b/ext/phar/tests/phpinfo_003.phpt
index 031d3cf497..045f1a090d 100644
--- a/ext/phar/tests/phpinfo_003.phpt
+++ b/ext/phar/tests/phpinfo_003.phpt
@@ -24,7 +24,7 @@ Phar
Phar: PHP Archive support => enabled
Phar EXT version => %s
Phar API version => 1.1.1
-SVN revision => %cRevision: %s $
+SVN revision => %cId: %s $
Phar-based phar archives => enabled
Tar-based phar archives => enabled
ZIP-based phar archives => enabled
diff --git a/ext/phar/tests/readfile_edgecases.phpt b/ext/phar/tests/readfile_edgecases.phpt
index 2c93c8b221..3cf69edb9a 100644
--- a/ext/phar/tests/readfile_edgecases.phpt
+++ b/ext/phar/tests/readfile_edgecases.phpt
@@ -36,7 +36,7 @@ include $pname . '/foo/hi';
<?php rmdir(dirname(__FILE__) . '/poo'); ?>
<?php unlink(dirname(__FILE__) . '/foob'); ?>
--EXPECTF--
-Warning: readfile() expects parameter 1 to be string, array given in %sreadfile_edgecases.php on line %d
+Warning: readfile() expects parameter 1 to be a valid path, array given in %sreadfile_edgecases.php on line %d
blah
<?php
readfile("foo/" . basename(__FILE__));
@@ -60,4 +60,4 @@ readfile("../oops");
?>
Warning: readfile(phar://%sreadfile_edgecases.phar.php/oops): failed to open stream: phar error: path "oops" is a directory in phar://%sreadfile_edgecases.phar.php/foo/hi on line %d
-===DONE=== \ No newline at end of file
+===DONE===
diff --git a/ext/phar/tests/zip/notphar.phpt b/ext/phar/tests/zip/notphar.phpt
index 3450c84bbd..c0648c4953 100644
--- a/ext/phar/tests/zip/notphar.phpt
+++ b/ext/phar/tests/zip/notphar.phpt
@@ -4,6 +4,7 @@ Phar: a non-executable zip with no stub named .phar.zip
<?php if (!extension_loaded("phar")) die("skip"); ?>
--INI--
phar.readonly=1
+detect_unicode=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip';
diff --git a/ext/phar/util.c b/ext/phar/util.c
index 9797ec8250..d5b6a5dd13 100644
--- a/ext/phar/util.c
+++ b/ext/phar/util.c
@@ -156,7 +156,6 @@ int phar_seek_efp(phar_entry_info *entry, off_t offset, int whence, off_t positi
break;
default:
temp = 0;
- break;
}
if (temp > eoffset + (off_t) entry->uncompressed_filesize) {
@@ -274,7 +273,7 @@ char *phar_find_in_include_path(char *filename, int filename_len, phar_archive_d
return phar_save_resolve_path(filename, filename_len TSRMLS_CC);
}
- fname = zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename(TSRMLS_C);
fname_len = strlen(fname);
if (PHAR_G(last_phar) && !memcmp(fname, "phar://", 7) && fname_len - 7 >= PHAR_G(last_phar_name_len) && !memcmp(fname + 7, PHAR_G(last_phar_name), PHAR_G(last_phar_name_len))) {
@@ -366,7 +365,7 @@ splitted:
goto doit;
}
- fname = zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename(TSRMLS_C);
if (SUCCESS != phar_split_fname(fname, strlen(fname), &arch, &arch_len, &entry, &entry_len, 1, 0 TSRMLS_CC)) {
goto doit;
@@ -524,7 +523,7 @@ not_stream:
/* check in calling scripts' current working directory as a fall back case */
if (zend_is_executing(TSRMLS_C)) {
- char *exec_fname = zend_get_executed_filename(TSRMLS_C);
+ char *exec_fname = (char*)zend_get_executed_filename(TSRMLS_C);
int exec_fname_length = strlen(exec_fname);
const char *p;
int n = 0;
@@ -2218,7 +2217,7 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat
void phar_add_virtual_dirs(phar_archive_data *phar, char *filename, int filename_len TSRMLS_DC) /* {{{ */
{
- char *s;
+ const char *s;
while ((s = zend_memrchr(filename, '/', filename_len))) {
filename_len = s - filename;