This guide covers migration from the 3.x line to the 4.0 line.
- PHP 8.2+
mysqliorpdo_mysqlextension
4.0 introduces strict runtime validation for query builder and helper input.
Invalid query-shape arguments now fail fast with Foolz\SphinxQL\Exception\SphinxQLException.
The following now throw on invalid input:
setType()unknown query typecompile()with no selected query typefrom()with empty or invalid index inputfacet()with non-FacetargumentorderBy()/withinGroupOrderBy()invalid direction (must beASCorDESC)limit()/offset()negative or invalid integer valuesgroupNBy()non-positive valueswhere()/having()invalid filter value shape forIN/NOT IN/BETWEENinto(),columns(),values(),value(),set()invalid/empty inputupdate()->compile()/update()->execute()withoutinto($index)setQueuePrev()non-SphinxQLargument
- empty
facet()input - empty function/params in
facetFunction()andorderByFunction() - invalid direction in
orderBy()/orderByFunction() - negative or invalid
limit()/offset()
Helper methods now validate required identifiers and argument shapes:
showTables()acceptsnull/empty for unfilteredSHOW TABLES, and validates non-string filtersdescribe(),showIndexStatus(),flushRtIndex(),truncateRtIndex(),optimizeIndex(),flushRamchunk(), etc.setVariable()validates variable names and array valuescallSnippets()andcallKeywords()validate required argumentscreateFunction()validates return type (INT,UINT,BIGINT,FLOAT,STRING)- capability-aware APIs are available via
getCapabilities()/supports() - feature-gated methods may throw
UnsupportedFeatureExceptionwhen unsupported
Percolate input now rejects invalid payload types earlier instead of relying on implicit coercion, and string sanitization paths are null-safe.
Driver-level connection/query exceptions now include a source prefix:
[mysqli][connect]...[mysqli][query]...[pdo][connect]...[pdo][query]...
If your code matches exact exception strings, update those checks to match message fragments or exception classes.
- Validate user input before passing it to query builder methods.
- Replace implicit coercions with explicit typing/casting in your app layer.
- Prefer exception-class checks over exact message equality.
- Run your integration tests against your target engine (
Sphinx2,Sphinx3,Manticore). - Prefer
supports($feature)checks before engine-specific helper calls.