<?php
$cases = [
['user@example.com', 'user@example.com'],
['bad', false],
['', false],
];
foreach ($cases as [$in, $want]) {
$got = filter_var($in, FILTER_VALIDATE_EMAIL);
echo "$in => ", var_export($got, true), ($got == $want) ? " OK\n" : " FAIL\n";
}
Category
php-in-php· php-src-strictProblem
Email validation for
filter_var($v, FILTER_VALIDATE_EMAIL)is implemented in PHP (ext/filter/VmFilter.php—validateEmail()), but JIT/AOT duplicate the regex/token rules inlib/JIT/Builtin/StringFilterEmail.php(~343 lines of LLVM).Same SSOT problem as #9858 (boolean parse): two implementations drift on edge cases (IDN, quoted local-part, etc.).
php-src reference
ext/filter/logical_filters.c—php_filter_validate_emailext/filter/filter.cRepro
Scope
ext/filter/FilterEmailJitHelper.php(new)VmFilter::validateEmail()lib/JIT/Builtin/StringFilterEmail.phpDone when
StringFilterEmail.phpreduced to thin bridge (−300+ LLVM lines)TypeErrorvia shared guards./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter FilterEmail'greenRelated