You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the third argument to version_compare() is not a valid comparison operator, Zend throws ValueError. This compiler returns normally (no exception) — silent wrong behavior.
ext/standard/VmInfo.php — applyVersionCompareOperator() throws LogicException today; switch to ValueError with Zend message and ensure all invalid operators are rejected (including silent fall-through).
JIT/AOT: JitInfo::version_compare / runtime __compiler_version_compare if operator is lowered.
Verification
Extend test/compliance/cases/stdlib/version_compare.phpt or add dedicated PHPT
Activity
PurHur commentedon Jun 9, 2026
claim: PHP Compiler STD Lib — starting this run
Fix version_compare() invalid operator to throw ValueError (#4319) (#…
PurHur commentedon Jun 9, 2026
Merged via #7840.
Fix: Invalid
version_compare()$operatornow throwsValueErroron VM, JIT, and AOT compile paths (php-srcext/standard/versioning.cparity).Verification:
php bin/vm.php/php bin/jit.php test/repro-maintainer/version_compare_invalid_operator.php→ ValueError messagevendor/bin/phpunit --filter version_compare_invalid_operator→ VM + JIT greenphp bin/compile.php -l test/repro-maintainer/version_compare_invalid_operator.php→ exit 0Also fixed
StringVersionCompareJit::emitCompareSpecialForms()branchIftypo that blocked AOT LLVM lowering for valid-operator calls.