prune only the php binary archives, not the whole bin dir#121
Merged
simonhamp merged 1 commit intoJun 3, 2026
Merged
Conversation
php.js copies the one binary we need into the build resources, so the php-*.zip files left in the source tree are dead weight. We were removing the whole binary directory to clear them, which shipped every unused archive on a root path and could take the app down with it.
Target just the archives we manage (bin/{os}/{arch}/php-*.zip) so the build stays small, a user's other files in bin/ survive, and a root path no longer wipes the app (#115).
simonhamp
approved these changes
Jun 3, 2026
Member
|
Thanks for cleaning this up @gwleuverink 🙏🏼 |
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.
A small follow-up to #117. That stopped the app from being deleted, but as @bmckay959 spotted the binaries were still ending up in the bundle (his build went from 127MB to 212MB).
php.js extracts the one binary we need into the app's
build/phpresources during the build, so thephp-*.zipfiles left in the copied source tree are redundant. The previous approach removed the whole binary directory to clear them, which had two problems: on a root path (NATIVEPHP_PHP_BINARY_PATH=./) there's nothing to remove without taking the app with it, so it skipped and left every archive behind; and elsewhere it could delete files a user keeps alongside the binaries.This targets only the archives we manage, at their fixed
bin/{os}/{arch}/php-*.ziplocation, never the containing directory. The build stays small, unrelated files inbin/survive, and the path collapse is gone sinceapp/./binnormalises toapp/binrather than the app root.Reworked the two tests to assert the archives are pruned while the app (and an unrelated
bin/file) survive, instead of asserting the binaries are kept. Checked against the default, a custom subdir, and the root./path.Full suite passes, Pint and PHPStan clean.