1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

phar: Simplify phar_wrapper_stat() (#20222)

We can pass NULL instead of the error pointer, as we never use the value
of the error pointer anyway.
This commit is contained in:
Niels Dossche
2025-10-19 23:03:18 +02:00
committed by GitHub
parent 552c588d4f
commit a29c5d6928

View File

@@ -558,7 +558,7 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f
php_stream_statbuf *ssb, php_stream_context *context) /* {{{ */
{
php_url *resource = NULL;
char *internal_file, *error;
char *internal_file;
phar_archive_data *phar;
phar_entry_info *entry;
size_t internal_file_len;
@@ -582,16 +582,10 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f
internal_file = ZSTR_VAL(resource->path) + 1; /* strip leading "/" */
/* find the phar in our trusty global hash indexed by alias (host of phar://blah.phar/file.whatever) */
if (FAILURE == phar_get_archive(&phar, ZSTR_VAL(resource->host), ZSTR_LEN(resource->host), NULL, 0, &error)) {
if (FAILURE == phar_get_archive(&phar, ZSTR_VAL(resource->host), ZSTR_LEN(resource->host), NULL, 0, NULL)) {
php_url_free(resource);
if (error) {
efree(error);
}
return FAILURE;
}
if (error) {
efree(error);
}
if (*internal_file == '\0') {
/* root directory requested */
phar_dostat(phar, NULL, ssb, true);