[BUGFIX] Enhance alias resolving and reduce file system invocation [v3] #31
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.
Consider direct alias invocation without being registered
Invoking an aliased phar like
phar:///path/to/phar.phar/autoload.php
would allow to extract and register a potential alias name of the base
name at
/path/to/phar.phar
. Using alias names directly inside phararchive does provide any possibility to map its full path to an alias
(e.g. directly invoking
phar//alias.phar/autoload.php
would fail).This change aims to resolve the original base name by walking the
current stack trace backwards. In terms of performance this is not
ideal, but it's the only chance to retrieve the required information.
That's also why the next section addresses performance.
Enhance performance by reducing file system invocation
Interceptors have to resolve the base file name from some given
Phar invocation request. Internally the given path is traversed until
a valid file is found in the file system and considered as the base
name of the Phar archive.
This change reduces superfluous calls to
is_file
when splittingthe path in order to resolve the actual base name.
Resolves: #21
Resolves: #23