Skip to content

JIT: htmlspecialchars() native fast path (ENT_QUOTES, UTF-8) #124

@PurHur

Description

@PurHur

Problem

ext/standard/JitHtmlspecialchars.php exists but web output must be correct and fast for every echo chain. VM delegates to VmString::htmlspecialchars; JIT may fall back or have incomplete flag handling.

Goal

htmlspecialchars($s, ENT_QUOTES, 'UTF-8') matches PHP for & < > " ' on VM and JIT without calling Zend.

Implementation plan

  1. Audit JitHtmlspecialchars vs VmString::htmlspecialchars parity.
  2. Implement ENT_QUOTES / ENT_HTML5 subset in LLVM (table-driven entity replace).
  3. Compliance PHPT mirroring test/real/cases/web_htmlspecialchars.phpt under JIT suite (CI: Run JIT compliance tests in CI (fix LLVM skip in PHPUnit) #98).
  4. Fuzz edge: empty string, UTF-8 multibyte (reject or pass per Docs: Rewrite README feature list to match current compiler (2026) #48 docs).

Acceptance criteria

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITarea:webWeb / CGI / superglobalsenhancementNew feature or requestphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions