Skip to content

v1.4.0

Compare
Choose a tag to compare
@Thavarshan Thavarshan released this 23 Jun 05:13
· 27 commits to main since this release
d6e06dd

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
  • 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

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)
  • 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
  • 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