Migrating to 4.0¶
This page summarizes migration from the 3.x line to 4.0.
Baseline Requirements¶
PHP 8.2+
mysqliorpdo_mysqlextension
Key Behavioral Changes¶
4.0 introduces stricter runtime validation. Invalid query-shape input now throws
Foolz\\SphinxQL\\Exception\\SphinxQLException instead of being coerced.
Builder validation highlights:
unknown
setType()valuescompile()without selecting a query typeinvalid
from()inputinvalid
facet()payload typeinvalid
orderBy()/withinGroupOrderBy()directioninvalid
limit()/offset()/groupNBy()valuesinvalid
IN/NOT IN/BETWEENvalue shapesmissing
into($index)forupdate()before compile/execute
Facet validation highlights:
empty
facet()empty function/params in
facetFunction()andorderByFunction()invalid direction
invalid
limit()/offset()values
Helper validation highlights:
required identifiers must be non-empty strings
stricter
setVariable()and CALL option validationhelper feature-gated methods can raise
UnsupportedFeatureException
Percolate validation highlights:
stricter payload checks for
documents()and optionsearlier failure for unsupported/invalid document shapes
Exception Message Prefixes¶
Driver exceptions now include explicit source prefixes, for example:
[mysqli][connect]...[mysqli][query]...[pdo][connect]...[pdo][query]...
Migration Checklist¶
Validate user input before passing values to builder/helper methods.
Replace implicit coercion assumptions with explicit casting in your app layer.
Prefer exception class checks over full-message string equality checks.
Run integration tests against your target backend (Sphinx 2, Sphinx 3, or Manticore).
Add capability checks (
supports()) for backend-specific helper calls.
Repository Source¶
The canonical migration checklist also exists in MIGRATING-4.0.md at repository root.