Skip to content

Make PHAR builds reproducible regardless of the file system - #117

Merged
theseer merged 1 commit into
theseer:masterfrom
sebastianbergmann:master
Sep 30, 2026
Merged

theseer merged 1 commit into
theseer:masterfrom
sebastianbergmann:master

Conversation

@sebastianbergmann

Copy link
Copy Markdown
Contributor

Projects that distribute their software as a PHAR built with phpab --phar increasingly want their builds to be reproducible: building the same source code with the same tools should produce a PHAR that is identical bit for bit, no matter who builds it or on which machine. This is what allows users and third parties to independently confirm that a published PHAR really corresponds to the source code it claims to be built from, and it is a building block for supply-chain security practices such as SLSA build provenance.

Until now, phpab --phar added files to the PHAR in whatever order the file system returned them. That order is not defined and differs between file systems and operating systems, for example between macOS and Linux, or between a developer's machine and a CI runner. Building the same input in two different environments could therefore result in two different PHARs, even though their contents were the same.

With this change, files are always added to the PHAR in the same, well-defined order. Building the same input produces the same PHAR, independent of the file system it is built on.

There is no change in functionality: the generated PHARs contain the same files and behave exactly as before. Only the order of the entries inside the archive is now deterministic.

@theseer theseer self-assigned this Sep 30, 2026
@theseer
theseer merged commit 1f32778 into theseer:master Sep 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants