v1.4.0
Added
-
Uninstall Command: New
phpvm uninstall <version>
command to remove installed PHP versions- Supports all package managers: Homebrew, APT, DNF, YUM, Pacman
- Automatically detects installed packages before attempting removal
- Smart cleanup of symlinks and active version when uninstalling currently active PHP
- Includes comprehensive test mode support with mock package databases
- Provides clear warnings when attempting to uninstall non-existent versions
-
Enhanced Shell Integration: Improved sourcing support with automatic .phpvmrc detection
- Sets
PHPVM_FUNCTIONS_LOADED=true
environment variable when sourced - Auto-switches PHP version based on .phpvmrc when script is sourced (configurable via
PHPVM_AUTO_USE
) - Better function availability detection for shell integration
- Sets
-
Advanced Execution Control: New
PHPVM_SOURCED
environment variable for explicit execution control- Supports
true/1/yes
to force sourcing mode - Supports
false/0/no
to force execution mode - Provides override mechanism for edge cases and automation
- Supports
Changes
-
Robust POSIX Compliance: Complete rewrite of execution detection logic
- Replaced bash-specific
[[ "${BASH_SOURCE[0]}" == "${0}" ]]
with 3-layer POSIX detection - Layer 1: Explicit override via
PHPVM_SOURCED
environment variable - Layer 2: Test mode detection (
PHPVM_TEST_MODE
) - Layer 3: POSIX-compliant return test
(return 0 2>/dev/null)
- Now works reliably on Ubuntu/Mint systems using dash shell (
/bin/sh
)
- Replaced bash-specific
-
Enhanced Error Handling: Improved function validation and debugging
- Added function existence checks before execution
- Better error messages with script corruption detection
- Enhanced debug logging throughout execution flow
-
Improved Test Infrastructure: Extended mock system for uninstall testing
- Package manager-specific mock directories for test mode
- Better package detection simulation across different systems
- More comprehensive test coverage for edge cases
Fixed
-
Ubuntu/Mint Compatibility: Resolved "Bad substitution" errors on systems using dash shell
- Issue occurred when
/bin/sh
pointed to dash instead of bash - Script now fully POSIX-compliant and works across all Unix-like systems
- No more dependency on bash-specific features
- Issue occurred when
-
Shell Sourcing Reliability: Fixed inconsistent behavior when sourcing script
- Improved detection of sourced vs executed context
- Better handling of edge cases in different shell environments
- More predictable behavior across bash, dash, zsh, and other POSIX shells
-
Package Manager Detection: Enhanced validation for uninstall operations
- Better regex patterns for package detection across different package managers
- Improved error handling for package manager-specific commands
- More accurate installed package verification before removal attempts