Skip to content

Commit a29c5d6

Browse files
authored
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.
1 parent 552c588 commit a29c5d6

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

ext/phar/stream.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f
558558
php_stream_statbuf *ssb, php_stream_context *context) /* {{{ */
559559
{
560560
php_url *resource = NULL;
561-
char *internal_file, *error;
561+
char *internal_file;
562562
phar_archive_data *phar;
563563
phar_entry_info *entry;
564564
size_t internal_file_len;
@@ -582,16 +582,10 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f
582582

583583
internal_file = ZSTR_VAL(resource->path) + 1; /* strip leading "/" */
584584
/* find the phar in our trusty global hash indexed by alias (host of phar://blah.phar/file.whatever) */
585-
if (FAILURE == phar_get_archive(&phar, ZSTR_VAL(resource->host), ZSTR_LEN(resource->host), NULL, 0, &error)) {
585+
if (FAILURE == phar_get_archive(&phar, ZSTR_VAL(resource->host), ZSTR_LEN(resource->host), NULL, 0, NULL)) {
586586
php_url_free(resource);
587-
if (error) {
588-
efree(error);
589-
}
590587
return FAILURE;
591588
}
592-
if (error) {
593-
efree(error);
594-
}
595589
if (*internal_file == '\0') {
596590
/* root directory requested */
597591
phar_dostat(phar, NULL, ssb, true);

0 commit comments

Comments
 (0)