Repository navigation
Fix efree target from error to *error - #25376
Closed
matyapiro31 wants to merge 1 commit into
Closed
matyapiro31 wants to merge 1 commit into
matyapiro31 wants to merge 1 commit into
Conversation
error is defined as char **, so in this line, free *error is correct and insert NULL after free.
Girgias
approved these changes
Nov 11, 2026
Girgias
left a comment
Member
There was a problem hiding this comment.
This can probably be simplified on master as you cannot have a non null phar pointer and an error at the same time.
LamentXU123
approved these changes
Nov 11, 2026
LamentXU123
left a comment
Member
There was a problem hiding this comment.
Yeah. I will remove it when merging to master
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index bee5fe7..53691be 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -489,7 +489,6 @@ static zend_result phar_open_parsed_phar(
size_t fname_len,
/* copyable & hash update */ zend_string *alias,
bool is_data,
- uint32_t options,
phar_archive_data** pphar,
char **error
) {
@@ -554,10 +553,6 @@ static zend_result phar_open_parsed_phar(
*pphar = NULL;
}
- if (phar && error && !(options & REPORT_ERRORS)) {
- efree(error);
- }
-
return FAILURE;
}
}
@@ -1344,7 +1339,7 @@
return FAILURE;
}
check_file:
- if (phar_open_parsed_phar(ZSTR_VAL(fname), ZSTR_LEN(fname), alias, is_data, options, test, &my_error) == SUCCESS) {
+ if (phar_open_parsed_phar(ZSTR_VAL(fname), ZSTR_LEN(fname), alias, is_data, test, &my_error) == SUCCESS) {
*pphar = *test;
if ((*test)->is_data && !(*test)->is_tar && !(*test)->is_zip) {
@@ -1546,7 +1541,7 @@
is_data = true;
}
- if (phar_open_parsed_phar(fname, fname_len, alias, is_data, options, pphar, error) == SUCCESS) {
+ if (phar_open_parsed_phar(fname, fname_len, alias, is_data, pphar, error) == SUCCESS) {
return SUCCESS;
} else if (error && *error) {
return FAILURE;
@@ -2295,7 +2290,7 @@
return FAILURE;
}
- if (phar_open_parsed_phar(ZSTR_VAL(fname), ZSTR_LEN(fname), alias, false, REPORT_ERRORS, NULL, NULL) == SUCCESS) {
+ if (phar_open_parsed_phar(ZSTR_VAL(fname), ZSTR_LEN(fname), alias, false, NULL, NULL) == SUCCESS) {
return SUCCESS;
}
LamentXU123
added a commit
that referenced
this pull request
Nov 11, 2026
On master, remove the obsolete error cleanup and its unused options parameter. phar_get_archive() returns NULL on errors, so a returned archive has no error message to free. * PHP-8.6: Fix error buffer cleanup in phar_open_parsed_phar() (#25376)
Member
|
Thanks |
t0ny4
pushed a commit
to t0ny4/php-src
that referenced
this pull request
Nov 11, 2026
* PHP-8.4: Fix error buffer cleanup in phar_open_parsed_phar() (php#25376)
t0ny4
pushed a commit
to t0ny4/php-src
that referenced
this pull request
Nov 11, 2026
* PHP-8.5: Fix error buffer cleanup in phar_open_parsed_phar() (php#25376)
arnaud-lb
added a commit
to jorgsowa/php-src
that referenced
this pull request
Nov 11, 2026
* PHP-8.6: Fix error buffer cleanup in phar_open_parsed_phar() (php#25376) Fix phpGH-25306: Assertion status == LXB_STATUS_OK in dom_parse_selector when lexbor allocation fails Fix AST printing dropping readonly on promoted parameters (phpGH-25207) Fix truncated anonymous class names in error messages and logs (phpGH-25352) ext/gd: blame the points array when a polygon has too few points ext/gd: keep the brush and tile images alive while the destination uses them ext/standard/dns.c: drop partially built records in php_parserr()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
error is defined as char **, so in this line, free *error is correct and insert NULL after free.
This error if statement is dead non-reachable code.