Problem
On machines where the legacy zvec PHP extension (v0.4.10, php-ext/) is installed via php.ini, require src/ZVec.php returns early and FFI-only classes never load — e.g. Class "ZVecIndexParams" not found in tests/test_index_params.phpt.
Root cause
src/ZVec.php:9 bails out before loading any PHP classes when the legacy extension is present:
if (extension_loaded('zvec')) return;
The installed extension (v0.4.10) defines only the older classes (ZVec, ZVecSchema, ZVecDoc, ZVecVectorQuery, …) but not the newer FFI-only helper classes — ZVecIndexParams, ZVecGroupByVectorQuery, ZVecCollectionStats, ZVecFieldSchema. Because of the early return, the class_alias block at the bottom of src/ZVec.php (lines 2428–2442) never runs.
Verification
php -m | grep zvec # zvec (v0.4.10)
php -n -r 'var_dump(extension_loaded("zvec"), extension_loaded("ffi"));'
# bool(false) bool(true) # -n fixes it
php -r 'require "src/ZVec.php"; var_dump(class_exists("ZVecIndexParams"));'
# bool(false)
Pre-existing: introduced in commit c2f0c7f (#25), independent of the v0.6.0 migration (#171–#177).
Workaround (current)
Run the suite with php run-tests.php -n tests/ (run-tests passes -n to child PHP processes — line 474), which disables the extension and loads the full FFI class set.
Suggested fixes
- Make the early return conditional on the extension actually providing the classes:
if (extension_loaded('zvec') && class_exists('ZVecIndexParams')) return;
- Document the
-n requirement in AGENTS.md (Testing Requirements section) so contributors on machines with the old extension don't hit this
- Long term: ensure the
php-ext/ extension build keeps parity with FFI classes or remove it from the test path
Problem
On machines where the legacy zvec PHP extension (v0.4.10,
php-ext/) is installed viaphp.ini,require src/ZVec.phpreturns early and FFI-only classes never load — e.g.Class "ZVecIndexParams" not foundintests/test_index_params.phpt.Root cause
src/ZVec.php:9bails out before loading any PHP classes when the legacy extension is present:The installed extension (v0.4.10) defines only the older classes (
ZVec,ZVecSchema,ZVecDoc,ZVecVectorQuery, …) but not the newer FFI-only helper classes —ZVecIndexParams,ZVecGroupByVectorQuery,ZVecCollectionStats,ZVecFieldSchema. Because of the early return, theclass_aliasblock at the bottom ofsrc/ZVec.php(lines 2428–2442) never runs.Verification
Pre-existing: introduced in commit
c2f0c7f(#25), independent of the v0.6.0 migration (#171–#177).Workaround (current)
Run the suite with
php run-tests.php -n tests/(run-tests passes-nto child PHP processes — line 474), which disables the extension and loads the full FFI class set.Suggested fixes
-nrequirement inAGENTS.md(Testing Requirements section) so contributors on machines with the old extension don't hit thisphp-ext/extension build keeps parity with FFI classes or remove it from the test path