8000 Fixed duplicate $PHPBREW_PATH in $PATH in Fish by morozov · Pull Request #1101 · phpbrew/phpbrew · GitHub 8000
[go: up one dir, main page]

Skip to content

Fixed duplicate $PHPBREW_PATH in $PATH in Fish#1101

Merged
morozov merged 1 commit intophpbrew:masterfrom
morozov:fish-double-init
Dec 19, 2019
Merged

Fixed duplicate $PHPBREW_PATH in $PATH in Fish#1101
morozov merged 1 commit intophpbrew:masterfrom
morozov:fish-double-init

Conversation

@morozov
Copy link
Contributor
@morozov morozov commented Dec 19, 2019

If PHPBrew is initialized twice: once via ~/.profile (so that desktop applications have the PHPBrew-managed PHP in $PATH) and once via ~/.config/fish/fish.config (for applications run via shell), the $PHPBREW_PATH will appear in $PATH in the Fish shell.

Without additional configuration, it can be reproduced in shell:

$ phpbrew use 7.4.0
$ source ~/.phpbrew/phpbrew.fish
$ source ~/.phpbrew/phpbrew.fish
$ source ~/.phpbrew/phpbrew.fish
$ echo $PATH
/home/morozov/.phpbrew/php/php-7.4.0/bin /home/morozov/.phpbrew/php/php-7.4.0/bin /home/morozov/.phpbrew/php/php-7.4.0/bin /home/morozov/.phpbrew/php/php-7.4.0/bin /home/morozov/.phpbrew/bin /usr/local/sbin ...

It doesn't happen in Bash because __phpbrew_load_user_config there calls __phpbrew_set_path internally, not something like export PATH=$PHPBREW_PATH:$PATH.

Additionally, the initialization logic has been moved to the end of the script to make sure all needed functions are declared at the initialization time.

Also, $PATH_WITHOUT_PHPBREW is no longer exported.

If PHPBrew is initialized twice: once via `~/.profile` (so that desktop applications have the PHPBrew-managed PHP in $PATH) and once via `~/.config/fish/fish.config` (for applications run via shell), the `$PHPBREW_PATH` will appear in `$PATH` in the Fish shell.

It doesn't happen in Bash because `__phpbrew_load_user_config` there calls `__phpbrew_set_path` internally, not something like `export PATH=$PHPBREW_PATH:$PATH`.

Additionally, the initialization logic has been moved to the end of the script to make sure all needed functions are declared at the initialization time.

Also, `$PATH_WITHOUT_PHPBREW` and `$PHPBREW_VERSION_REGEX` are no longer exported.
@morozov morozov self-assigned this Dec 19, 2019
@morozov morozov added this to the Release 1.25.0 milestone Dec 19, 2019
@morozov morozov merged commit 4f2fdda into phpbrew:master Dec 19, 2019
@morozov morozov deleted the fish-double-init branch December 19, 2019 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments

0