-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Fixed issue #60953 #297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed issue #60953 #297
Conversation
bump. |
oldname_ext = strstr(basename, "."); | ||
} | ||
|
||
newname = strndup(basename, (oldname_ext - basename)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why strndup and not estrndup? And why make a second copy, basename is already temp copy, can't we just put a null in proper place and use it in spprintf then?
@ralphschindler ping? |
any news? |
Updated addressing your concerns. I will look at the 2 failing tests next, and fix that \t/space formatting issue. |
@smalyshev perhaps we can revisit this for inclusion in 7? |
Altered phar_rename_archive() such that it will look for '.phar' first, then '.tar' && '.zip' in data phar files before falling back on finding anything after the first '.' in a file extension
8f0850b
to
9acb239
Compare
- removed backwards compatibility file name extension code - fixed all tests and their cleanup to reflect new file name suffixes
9acb239
to
788ac67
Compare
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could make the code be far less indented and more readable and more maintainable by using something like:
int i;
char *extensions[] = {
".phar",
".tar",
".tgz",
".zip"
};
int extension_count = sizeof(extensions)/sizeof(extensions[0]);
for (i=0 ; oldname_ext == NULL && i < extension_count ; i++){
oldname_ext = strstr(basename, extensions[i]);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have this exact-ish (similar) thing locally as I need to add one more extension (tbz2), will push it tonight. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, Dan's code looks much cleaner.
Travis is still not happy as it looks. |
I have not pushed any updates yet, which would trigger a new build (I force pushed my last set of changes, which made travis unhappy). I have one other place to fix renaming before it's complete. (See mailing list for details). |
Comment on behalf of krakjoe at php.net: Since we have been waiting for this PR to be completed for more than a year, and since this PR has merge conflicts with current master, I'm closing the PR. If anyone is watching, please take this action as encouragement to open a clean PR. |
Altered phar_rename_archive() such that it will look for well known file extensions to strip off when attempting to rename. Not BC safe with regards to PHP-5x.
https://bugs.php.net/bug.php?id=60953
A large part of the motivation here is to allow dotted versions in the name of a phar, and expect the convert*() functions to do minimal processing on the file name, and allow those dotted version names to persist as they should be.
This allows the following to be possible: