## Category `stdlib` · **php-src-strict** ## Problem `filter_var()` second argument cannot accept `FILTER_*` named constants—the VM throws: ``` LogicException: filter_var() filter must be an integer in this compiler build ``` | Call | Zend | VM today | |------|------|----------| | `filter_var('42', FILTER_VALIDATE_INT)` | `42` | `LogicException` | | `filter_var('not-int', FILTER_VALIDATE_INT)` | `false` | `LogicException` | Distinct from umbrella **#4403** (full ext/filter parity)—this is the **constant-binding** blocker that prevents any `FILTER_*` call from working today. ## php-src reference - [php/php-src `ext/filter/filter.c`](https://github.com/php/php-src/blob/master/ext/filter/filter.c) — `php_filter_var`, filter id constants - [php/php-src `ext/filter/php_filter.h`](https://github.com/php/php-src/blob/master/ext/filter/php_filter.h) — `FILTER_VALIDATE_*` ids ## Repro ```bash ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_filter_var_constants.php' php bin/vm.php test/repro/maintainer_gap_filter_var_constants.php ``` ## Implementation hints (PHP-in-PHP) - `ext/filter/filter_var.php` (or `ext/standard/` shim) — resolve `FILTER_*` ints via shared builtin constant helper - Register filter constants in `StdlibConstants` or ext/filter module bootstrap if missing ## Done when - [ ] Repro script matches Zend under VM - [ ] `FILTER_VALIDATE_INT`, `FILTER_VALIDATE_BOOL`, `FILTER_SANITIZE_STRING` smoke paths work - [ ] Compliance guard added - [ ] JIT/AOT agree if filter id lowering exists ## Related - **#4403**, **#4934** — broader filter parity - **#9564**, **#9278** — int constant binding pattern - North star **#1492**
Category
stdlib· php-src-strictProblem
filter_var()second argument cannot acceptFILTER_*named constants—the VM throws:filter_var('42', FILTER_VALIDATE_INT)42LogicExceptionfilter_var('not-int', FILTER_VALIDATE_INT)falseLogicExceptionDistinct from umbrella #4403 (full ext/filter parity)—this is the constant-binding blocker that prevents any
FILTER_*call from working today.php-src reference
ext/filter/filter.c—php_filter_var, filter id constantsext/filter/php_filter.h—FILTER_VALIDATE_*idsRepro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_filter_var_constants.php' php bin/vm.php test/repro/maintainer_gap_filter_var_constants.phpImplementation hints (PHP-in-PHP)
ext/filter/filter_var.php(orext/standard/shim) — resolveFILTER_*ints via shared builtin constant helperStdlibConstantsor ext/filter module bootstrap if missingDone when
FILTER_VALIDATE_INT,FILTER_VALIDATE_BOOL,FILTER_SANITIZE_STRINGsmoke paths workRelated