You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
htmlspecialchars() / htmlentities() second argument cannot accept ENT_* named constants at runtime—the VM throws:
LogicException: htmlspecialchars() flags must be an integer in this compiler build
Call
Zend
VM today
htmlspecialchars("<a&'>", ENT_QUOTES)
'<a&'>'
LogicException
htmlentities("<a&'>", ENT_COMPAT)
'<a&\'>'
LogicException
Same class of bug as #9564 (PHP_ROUND_HALF_*), #9565 (PATHINFO_*), #9278 (SORT_*)—builtin arg lowering does not resolve core PHP constants to integers.
Category
stdlib· php-src-strictProblem
htmlspecialchars()/htmlentities()second argument cannot acceptENT_*named constants at runtime—the VM throws:htmlspecialchars("<a&'>", ENT_QUOTES)'<a&'>'LogicExceptionhtmlentities("<a&'>", ENT_COMPAT)'<a&\'>'LogicExceptionSame class of bug as #9564 (
PHP_ROUND_HALF_*), #9565 (PATHINFO_*), #9278 (SORT_*)—builtin arg lowering does not resolve core PHP constants to integers.php-src reference
ext/standard/html.c—php_htmlspecialchars,ENT_*flag handlingext/standard/basic_functions.stub.php— signaturesRepro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_htmlspecialchars_ent_flags.php' php bin/vm.php test/repro/maintainer_gap_htmlspecialchars_ent_flags.phpImplementation hints (PHP-in-PHP)
ext/standard/htmlspecialchars.php,ext/standard/htmlentities.php— resolveENT_*viaStdlibConstants/ shared builtin int-arg helper (same path as sort/round flags)ext/standard/VmString.php— semantics already correct once$flagsis an intJitHtmlspecialchars/ compile-time constant folding inhtmlspecialchars::compileTimeLongDone when
php bin/vm.php)ENT_QUOTES,ENT_COMPAT,ENT_HTML5combinations worktest/compliance/cases/stdlib/Related