Release 1.13.0: opt-in per-shell PHP switching - #23
Conversation
There was a problem hiding this comment.
馃挕 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 06f828af07
鈩癸笍 About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 馃憤.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| else | ||
| local old_ifs="$IFS" | ||
| IFS=: | ||
| for entry in $PATH; do |
There was a problem hiding this comment.
Preserve empty components when rebuilding PATH
When a Bash user's PATH contains an empty component, such as /usr/local/bin::/usr/bin or a trailing colon, unquoted IFS splitting drops that component. After phpvm deactivate, phpvm system, or a second phpvm use, the rebuilt PATH therefore no longer preserves the original command-search semantics (empty components represent the current directory). Parse and reconstruct the path without discarding empty fields.
Useful? React with 馃憤聽/ 馃憥.
| unset -f "$func_name" 2> /dev/null | ||
| done < <(declare -F | command awk '{print $3}' | command grep -E '^(phpvm_|phpvm$|main$|command_exists$|run_with_sudo$|log_with_timestamp$|set_active_version$|update_current_symlink$|create_directories$|ensure_phpvm_dirs$|detect_system$|get_os_info$|sanitize_input$|is_valid_version_format$|validate_php_version$|get_php_package_name$|get_php_binary_path$|is_php_package_installed$|pkg_install_php$|pkg_uninstall_php$|pkg_search_php$|brew_|linux_|install_php|uninstall_php$|use_php_version$|switch_to_|system_php_version$|list_installed_versions$|print_help$|print_version$|print_system_info$|find_phpvmrc$|auto_switch_php_version$|check_remi_repository$|detect_php_availability$|suggest_repository_setup$|get_installed_php_version$)') | ||
|
|
||
| unset -f phpvm 2> /dev/null || true |
There was a problem hiding this comment.
Remove all helper functions when unloading from Zsh
When phpvm is sourced in Zsh, declare -F does not enumerate functions as it does in Bash (-F is a floating-point parameter option in Zsh), so the preceding loop removes none of the phpvm_* helpers. This added statement removes only the public phpvm function, leaving the rest of phpvm loaded even though phpvm unload reports success; use a Zsh-compatible function enumeration path before returning.
Useful? React with 馃憤聽/ 馃憥.
Summary
Add opt-in per-shell PHP selection with
PHPVM_SWITCH_MODE=session. Bash and Zsh shells can select different CLI interpreters without changing shared Homebrew links or Linux alternatives. Global switching remains the default.The resolver now verifies the selected interpreter for
use,which,exec, andrun. Shell-local PATH and metadata stay aligned in child processes. Installation and self-update deliver Bash completions alongside the script. The release workflow validates real PHP 8.2 and 8.3 selections on Ubuntu and macOS before preparing a draft 1.13.0 release bundle.Validation
git diff --checkpass locally.