Support spawning worker process from within PHARs without file extension #61
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.
This changeset adds support for running from PHARs without a file extension. This is particularly common when installing PHARs as system binaries on Unix-like platforms.
While the
phar://
stream wrapper is wonderful, PHP exhibits some (afaict undocumented) behavior when it comes to PHARs with no file extension. I've written a more in-depth explanation on Twitter (https://twitter.com/another_clue/status/1493175007484301317), but the gist is that we can avoid this shortcoming by using an alias for the PHAR by first loading it. This now works out of the box without any special configuration by running the SQLite worker like this internally:The updated test suite confirms this works across all supported platforms, including Windows (which requires some special care via #60).
Builds on top of #60 and #55. Together with the referenced tickets and the upstream fixes required to get this in, you're looking at several days worth of debugging and toying around with different approaches to distill this to this minimal fix that works across all supported platforms. The underlying behavior is mostly undocumented in PHP afaict, so I'm quite happy with the resulting changeset.
Refs #5 for the underlying feature request.