hi all,
Phar::convertTo*() methods have a design flaw such that phar files can't
be successfully converted and retain the proper file suffix at the same
time when the base name contains dots. An expression of this is
attempting to convert something-v3.0.0.phar to say a tar.gz via
convertToExecutable(Phar::TAR, Phar::GZ);
My original patch respected BC when it was destined for PHP5, but now
I've cleaned it up and removed the retention of BC behavior, and I
intend it to be merged to PHP7 only. As such, existing tests also
needed modification.
I'd like some discussion, code review ... and if no objections, some
karma to commit this to master. The PR is here:
https://github.com/php/php-src/pull/297
Thanks,
Ralph
hi all,
Phar::convertTo*() methods have a design flaw such that phar files can't
be successfully converted and retain the proper file suffix at the same
time when the base name contains dots. An expression of this is
attempting to convert something-v3.0.0.phar to say a tar.gz via
convertToExecutable(Phar::TAR, Phar::GZ);My original patch respected BC when it was destined for PHP5, but now
I've cleaned it up and removed the retention of BC behavior, and I
intend it to be merged to PHP7 only. As such, existing tests also
needed modification.I'd like some discussion, code review ... and if no objections, some
karma to commit this to master. The PR is here:
Hi Ralph!
I recently stumbled over that issue, too; thanks for looking into it.
Looking at the patch, it seems, that some handling for bzip2 archives is
missing; I think if there are special cases for .tar, .tgz and .zip,
there should also be a case for .tbz2 (.tar.bz2).
--
Regards,
Mike
I recently stumbled over that issue, too; thanks for looking into it.
Looking at the patch, it seems, that some handling for bzip2 archives is
missing; I think if there are special cases for .tar, .tgz and .zip,
there should also be a case for .tbz2 (.tar.bz2).
Yep, I discussed this with a friend and did a quick search this morning.
It is missing, mostly because I didn't know how popular .tbz2 was as a
file extension - it is very rare. In most cases I see .tar.bz2 (a case
already handled by .tar). I can add .tbz2 as a handled file extension,
and restructure the code accordingly.
Additionally, I've found that phar_detect_phar_fname_ext() also needs
some suffix validation, which I will also add.
I will have a new commit for this in place tonight. (Which will also
trigger Travis to run again, I think it failed b/c I force pushed my
last commit).
Thanks for taking the time, I'll let you know when there are more
commits to review.
-ralph