Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions ext/phar/dirstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path,
if (!resource->scheme || !resource->host || !resource->path) {
if (resource->host && !resource->path) {
php_stream_wrapper_log_warn(wrapper, context, options, InvalidPath,
"phar error: no directory in \"%s\", must have at least phar://%s/ for root directory (always use full path to a new phar)",
path, ZSTR_VAL(resource->host));
"phar error: no directory in \"%s\", must have at least phar://%pS/ for root directory (always use full path to a new phar)",
path, resource->host);
php_url_free(resource);
return NULL;
}
Expand All @@ -277,7 +277,7 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path,
efree(error);
} else {
php_stream_wrapper_log_warn(wrapper, context, options, NotFound,
"phar file \"%s\" is unknown", ZSTR_VAL(resource->host));
"phar file \"%pS\" is unknown", resource->host);
}
php_url_free(resource);
return NULL;
Expand Down Expand Up @@ -379,8 +379,8 @@ int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mo
phar = phar_get_archive(ZSTR_VAL(resource->host), ZSTR_LEN(resource->host), NULL, 0, &error);
if (!phar) {
php_stream_wrapper_log_warn(wrapper, context, options, MkdirFailed,
"phar error: cannot create directory \"%s\" in phar \"%s\", error retrieving phar information: %s",
ZSTR_VAL(resource->path) + 1, ZSTR_VAL(resource->host), error);
"phar error: cannot create directory \"%s\" in phar \"%pS\", error retrieving phar information: %s",
ZSTR_VAL(resource->path) + 1, resource->host, error);
efree(error);
php_url_free(resource);
return 0;
Expand All @@ -394,16 +394,16 @@ int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mo
efree(e);
}
php_stream_wrapper_log_warn(wrapper, context, options, AlreadyExists,
"phar error: cannot create directory \"%s\" in phar \"%s\", directory already exists",
ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host));
"phar error: cannot create directory \"%s\" in phar \"%pS\", directory already exists",
ZSTR_VAL(resource->path)+1, resource->host);
php_url_free(resource);
return 0;
}

if (error) {
php_stream_wrapper_log_warn(wrapper, context, options, MkdirFailed,
"phar error: cannot create directory \"%s\" in phar \"%s\", %s",
ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host), error);
"phar error: cannot create directory \"%s\" in phar \"%pS\", %s",
ZSTR_VAL(resource->path)+1, resource->host, error);
efree(error);
php_url_free(resource);
return 0;
Expand All @@ -412,16 +412,16 @@ int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mo
if (phar_get_entry_info_dir(phar, ZSTR_VAL(resource->path) + 1, ZSTR_LEN(resource->path) - 1, 0, &error, true)) {
/* entry exists as a file */
php_stream_wrapper_log_warn(wrapper, context, options, AlreadyExists,
"phar error: cannot create directory \"%s\" in phar \"%s\", file already exists",
ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host));
"phar error: cannot create directory \"%s\" in phar \"%pS\", file already exists",
ZSTR_VAL(resource->path)+1, resource->host);
php_url_free(resource);
return 0;
}

if (error) {
php_stream_wrapper_log_warn(wrapper, context, options, MkdirFailed,
"phar error: cannot create directory \"%s\" in phar \"%s\", %s",
ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host), error);
"phar error: cannot create directory \"%s\" in phar \"%pS\", %s",
ZSTR_VAL(resource->path)+1, resource->host, error);
efree(error);
php_url_free(resource);
return 0;
Expand Down Expand Up @@ -451,8 +451,8 @@ int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mo

if (NULL == zend_hash_add_mem(&phar->manifest, entry.filename, &entry, sizeof(phar_entry_info))) {
php_stream_wrapper_log_warn(wrapper, context, options, MkdirFailed,
"phar error: cannot create directory \"%s\" in phar \"%s\", adding to manifest failed",
ZSTR_VAL(entry.filename), ZSTR_VAL(phar->fname));
"phar error: cannot create directory \"%pS\" in phar \"%pS\", adding to manifest failed",
entry.filename, phar->fname);
zend_string_efree(entry.filename);
return 0;
}
Expand All @@ -461,8 +461,8 @@ int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mo

if (error) {
php_stream_wrapper_log_warn(wrapper, context, options, MkdirFailed,
"phar error: cannot create directory \"%s\" in phar \"%s\", %s",
ZSTR_VAL(entry.filename), ZSTR_VAL(phar->fname), error);
"phar error: cannot create directory \"%pS\" in phar \"%pS\", %s",
entry.filename, phar->fname, error);
zend_hash_del(&phar->manifest, entry.filename);
efree(error);
return 0;
Expand Down Expand Up @@ -521,8 +521,8 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options
phar = phar_get_archive(ZSTR_VAL(resource->host), ZSTR_LEN(resource->host), NULL, 0, &error);
if (!phar) {
php_stream_wrapper_log_warn(wrapper, context, options, RmdirFailed,
"phar error: cannot remove directory \"%s\" in phar \"%s\", error retrieving phar information: %s",
ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host), error);
"phar error: cannot remove directory \"%s\" in phar \"%pS\", error retrieving phar information: %s",
ZSTR_VAL(resource->path)+1, resource->host, error);
efree(error);
php_url_free(resource);
return 0;
Expand All @@ -534,13 +534,13 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options
if (!entry) {
if (error) {
php_stream_wrapper_log_warn(wrapper, context, options, RmdirFailed,
"phar error: cannot remove directory \"%s\" in phar \"%s\", %s",
ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host), error);
"phar error: cannot remove directory \"%s\" in phar \"%pS\", %s",
ZSTR_VAL(resource->path)+1, resource->host, error);
efree(error);
} else {
php_stream_wrapper_log_warn(wrapper, context, options, NotFound,
"phar error: cannot remove directory \"%s\" in phar \"%s\", directory does not exist",
ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host));
"phar error: cannot remove directory \"%s\" in phar \"%pS\", directory does not exist",
ZSTR_VAL(resource->path)+1, resource->host);
}
php_url_free(resource);
return 0;
Expand Down Expand Up @@ -594,8 +594,8 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options

if (error) {
php_stream_wrapper_log_warn(wrapper, context, options, RmdirFailed,
"phar error: cannot remove directory \"%s\" in phar \"%s\", %s",
ZSTR_VAL(entry->filename), ZSTR_VAL(phar->fname), error);
"phar error: cannot remove directory \"%pS\" in phar \"%pS\", %s",
entry->filename, phar->fname, error);
php_url_free(resource);
efree(error);
return 0;
Expand Down
6 changes: 3 additions & 3 deletions ext/phar/func_interceptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ PHP_FUNCTION(phar_opendir) /* {{{ */
zend_string *entry = phar_fix_filepath(filename, filename_len, true);

if (ZSTR_VAL(entry)[0] == '/') {
spprintf(&name, 4096, "phar://%s%s", ZSTR_VAL(arch), ZSTR_VAL(entry));
spprintf(&name, 4096, "phar://%pS%pS", arch, entry);
} else {
spprintf(&name, 4096, "phar://%s/%s", ZSTR_VAL(arch), ZSTR_VAL(entry));
spprintf(&name, 4096, "phar://%pS/%pS", arch, entry);
}
zend_string_release_ex(entry, false);
zend_string_release_ex(arch, false);
Expand Down Expand Up @@ -135,7 +135,7 @@ static zend_string* phar_get_name_for_relative_paths(zend_string *filename, bool
ZSTR_VAL(entry), ZSTR_LEN(entry)
);
} else {
name = strpprintf(4096, "phar://%s/%s", ZSTR_VAL(arch), ZSTR_VAL(entry));
name = strpprintf(4096, "phar://%pS/%pS", arch, entry);
}
zend_string_release_ex(entry, false);
}
Expand Down
2 changes: 1 addition & 1 deletion ext/phar/phar.c
Original file line number Diff line number Diff line change
Expand Up @@ -3192,7 +3192,7 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type)
zend_file_handle f;

/* zip or tar-based phar */
name = zend_strpprintf(4096, "phar://%s/%s", ZSTR_VAL(file_handle->filename), ".phar/stub.php");
name = zend_strpprintf(4096, "phar://%pS/%s", file_handle->filename, ".phar/stub.php");
zend_stream_init_filename_ex(&f, name);
if (SUCCESS == zend_stream_open_function(&f)) {
zend_string_release(f.filename);
Expand Down
Loading
Loading