|
2 | 2 |
|
3 | 3 | ## [Unreleased] |
4 | 4 |
|
5 | | -### Removed |
| 5 | +## [v1.9.0](https://github.com/Thavarshan/phpvm/compare/v1.8.0...v1.9.0) - 2026-01-30 |
| 6 | + |
| 7 | +### Fixed |
| 8 | + |
| 9 | +- **Fixed error propagation in version resolution:** Commands like `phpvm use latest` and `phpvm install latest` now correctly propagate failures from `phpvm_resolve_version` instead of silently swallowing errors. |
| 10 | +- **Fixed state consistency in `switch_to_system_php`:** State file (`active_version=system`) is now only written AFTER the switch operation succeeds, preventing state lies when brew link operations fail. |
| 11 | +- **Fixed apt install/uninstall symmetry:** Uninstall now removes `php${version}-cli`, `php${version}-common`, and `php${version}-fpm` packages symmetrically with what install creates. |
| 12 | +- **Fixed alias directory reliability:** Alias directory creation is now required (not best-effort). If `$PHPVM_DIR/alias` cannot be created, phpvm fails with a clear error message. |
| 13 | +- **Fixed symlink robustness:** `update_current_symlink` now uses `command -v php` to resolve the actual binary path, ensuring the symlink points to what the shell would execute. |
| 14 | +- **Fixed path traversal vulnerability in alias resolution:** `phpvm_resolve_version` now validates alias names before file access, preventing path traversal attacks like `../../../etc/passwd`. |
| 15 | +- **Fixed path traversal vulnerability in alias commands:** `phpvm_alias` now validates alias names BEFORE any file path operations. |
| 16 | +- **Fixed trap restoration in sourced shells:** `phpvm_with_lock` now explicitly clears traps with `trap - SIGNAL` when user had no existing trap, preventing phpvm's cleanup traps from being permanently installed in the user's shell session. |
| 17 | +- **Fixed init ordering for help/version commands:** Moved command parsing before `phpvm_init_or_die` so `phpvm help` and `phpvm version` work without requiring package manager detection or system initialization. |
| 18 | +- **Fixed Linux version listing accuracy:** Unified all Linux package managers (apt/dnf/yum/pacman) to use `phpvm_linux_installed_versions` which scans actual binaries, eliminating inaccurate package name listings like `8.2-cli` or `8.2-fpm`. |
| 19 | +- **Fixed system PHP symlink consistency:** System switching now calls `update_current_symlink` to maintain consistent `$PHPVM_DIR/current` symlink behavior across all switching modes. |
| 20 | +- **Fixed alias security vulnerability:** Reordered validation in `phpvm_alias` to validate version format before using it in file path checks, preventing potential path traversal attacks with malicious alias targets. |
| 21 | +- **Fixed yum installation strategy:** Implemented proper Remi repository detection and naming conventions (`php82-php-cli` format), replacing incorrect `yum install php8.2` approach that would always fail. |
| 22 | +- **Fixed lock PID staleness:** Added explicit `lock_pid=""` reset at top of each `phpvm_lock` loop iteration to prevent stale PID values in error messages. |
| 23 | +- **Fixed unversioned PHP formula detection:** Homebrew's unversioned `php` formula is now correctly identified before any unlinking operations, preventing false version matches from system PHP. |
| 24 | +- **Fixed `phpvm which` for unversioned formulas:** Correctly returns path to unversioned PHP installed as `php` formula. |
| 25 | +- **Fixed apt package search:** `pkg_search_php()` now explicitly checks for `Candidate: (none)` to avoid false positives from `apt-cache policy`. |
| 26 | +- **Fixed `echo` usage in input validation:** Replaced `echo "$var" | grep` with `printf '%s\n' "$var" | grep` throughout to prevent interpretation of strings like `-n`, `-e`, backslash escapes. |
| 27 | +- **Fixed `phpvm_which()` failure propagation:** Now properly propagates failures from `phpvm_current` using `|| return $?`. |
| 28 | +- **Fixed shellcheck SC2221/SC2222 warnings:** Simplified `phpvm_is_sourced()` case pattern to avoid overlapping matches. |
| 29 | + |
| 30 | +### Changed |
| 31 | + |
| 32 | +- **Introduced `command_exists()` helper:** Replaced 40+ instances of `command -v X > /dev/null 2>&1` with single reusable function for cleaner command availability checks. |
| 33 | +- **Introduced `ensure_phpvm_dirs()` function:** Consolidated repeated `mkdir -p $PHPVM_DIR/X` patterns into centralized directory creation function. |
| 34 | +- **Introduced `brew_link_php_unversioned()` function:** Extracted duplicate `brew link php --force --overwrite` logic with error handling into single reusable function. |
| 35 | +- **Introduced `is_valid_version_format()` function:** Consolidated duplicate version regex validation pattern into single validation helper. |
| 36 | +- **Added `brew_php_major_minor()` helper:** Reads version directly from `$HOMEBREW_PREFIX/opt/php/bin/php` instead of PATH-based `php -r`, eliminating conflicts with system PHP. |
| 37 | +- **Reordered version switching flow:** Now resolves target formula, then unlinks all PHP, then links resolved formula, preventing "version check breaks after unlink" bugs. |
| 38 | +- **Improved Linux binary scanning:** Broadened skip patterns to prevent accidentally executing PHP helper binaries (`*fpm*`, `*cgi*`, `*dbg*`, `*ize*`, `*config*`). |
| 39 | +- **Ubuntu/Debian apt packages:** Changed from non-existent `php8.2` to actual `php8.2-cli` format used by ondrej/sury PPA. |
| 40 | +- **Fedora/RHEL dnf packages:** Implemented correct module stream approach instead of fictional versioned packages. |
| 41 | +- **Brew availability check:** Changed from fragile `brew search | grep` to stable `brew info <formula>` API. |
| 42 | +- **Trap preservation in `phpvm_with_lock()`:** Now saves and restores user's existing trap handlers instead of clobbering them. |
| 43 | +- **Stale lock detection and auto-cleanup:** Lock mechanism now checks if lock holder PID is still running and automatically removes stale locks. |
| 44 | + |
| 45 | +### Added |
| 46 | + |
| 47 | +- **Interactive shell guard:** Auto-switch from `.phpvmrc` now only runs in interactive shells using `case $- in *i*)` pattern. |
| 48 | +- **Test mode package manager bypass:** Test mode now sets sandbox defaults without requiring actual brew/apt/dnf. |
| 49 | + |
| 50 | +### Internal |
6 | 51 |
|
7 | | -- **Redundant qa.sh script:** Removed `qa.sh` as its functionality is fully covered by `make check`. |
| 52 | +- **Bash-only support documented:** Added explicit notice that script requires bash (uses bashisms). |
| 53 | +- **Intentional symlink behavior clarified:** Added comment explaining `update_current_symlink()` links to resolved `php` binary by design. |
| 54 | +- **Dnf module stream workflow:** Added inline documentation about RHEL/Fedora module stream management. |
| 55 | +- **Version bump:** Updated to v1.9.0. |
| 56 | +- **All tests passing:** 51 BATS tests pass (added 4 security tests for path traversal protection). |
| 57 | +- **Release documentation:** Added RELEASE_CHECKLIST.md and RELEASE_SUMMARY.md. |
8 | 58 |
|
9 | 59 | ## [v1.8.0](https://github.com/Thavarshan/phpvm/compare/v1.7.0...v1.8.0) - 2026-01-12 |
10 | 60 |
|
|
0 commit comments