Skip to content

Release 1.13.0: opt-in per-shell PHP switching - #23

Merged
Thavarshan merged 3 commits into
mainfrom
feature/session-switching
Sep 29, 2026
Merged

Thavarshan merged 3 commits into
mainfrom
feature/session-switching

Conversation

@Thavarshan

Copy link
Copy Markdown
Owner

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, and run. 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

  • 114 BATS tests pass, including session isolation, interpreter resolution, protected updates, and rollback.
  • Bash and Zsh syntax, ShellCheck, shfmt, and git diff --check pass locally.
  • The PR workflow runs the two-platform real interpreter smoke test before merge.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃挕 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".

Comment thread phpvm.sh
else
local old_ifs="$IFS"
IFS=:
for entry in $PATH; do

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 馃憤聽/ 馃憥.

Comment thread phpvm.sh
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 馃憤聽/ 馃憥.

@Thavarshan
Thavarshan merged commit 9d28fbb into main Sep 29, 2026
34 of 36 checks passed
@Thavarshan
Thavarshan deleted the feature/session-switching branch September 29, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants