Skip to content

Regression: htmlspecialchars() ENT_QUOTES — apostrophe encoded as ' not literal ' (re-#15272, ext/standard/html.c) #16937

Closed

Description

@PurHur

Category

stdlib · html encoding · php-src-strict

Problem

htmlspecialchars($s, ENT_QUOTES) encodes the apostrophe as the numeric entity ' instead of leaving a literal ' as Zend does on the reference profile.

Repro Zend 8.2 VM (2026-07-06)
htmlspecialchars("<a&'>", ENT_QUOTES) &lt;a&amp;'&gt; &lt;a&amp;&#039;&gt;

Discovered via maintainer VM/Zend repro scan (test/repro/maintainer_gap_htmlspecialchars_ent_flags.php). Regression of #15272 — closed but output still diverges on master.

php-src reference

PHP implementation target

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_htmlspecialchars_ent_flags.php'
./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_htmlspecialchars_ent_flags.php'
# VM first line: &lt;a&amp;&#039;&gt;  vs Zend: &lt;a&amp;'&gt;

Done when

  • VM output matches Zend for ENT_QUOTES and ENT_COMPAT lines in repro
  • Compliance .phpt under test/compliance/cases/stdlib/html/
  • php-src-strict; JIT/AOT use same entity table

Activity

  1. added
    bugSomething isn't working
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 6, 2026
  2. PurHur commented on Jul 6, 2026

    @PurHur
    OwnerAuthor

    claim: cursor-agent-lane-c — starting this run

  3. PurHur commented on Jul 6, 2026

    @PurHur
    OwnerAuthor

    claim released: repro matches Zend 8.2 — both output &#039; for htmlspecialchars ENT_QUOTES; compliance htmlspecialchars_flags.phpt expects same. Issue stale.

  4. PurHur commented on Jul 7, 2026

    @PurHur
    OwnerAuthor

    claim: cursor-agent-lane-c — starting this run (htmlspecialchars ENT_QUOTES apostrophe encoding)

  5. PurHur commented on Jul 7, 2026

    @PurHur
    OwnerAuthor

    Scan: repro test/repro/maintainer_gap_htmlspecialchars_ent_flags.php matches Zend 8.2 on master (both lines). VM and Zend both emit &#039; for htmlspecialchars ENT_QUOTES and literal ' for htmlentities ENT_COMPAT. Issue appears resolved — closing candidate.

  6. PurHur commented on Jul 9, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — starting this run

  7. PurHur commented on Jul 9, 2026

    @PurHur
    OwnerAuthor

    claim released: repro matches Zend PHP 8.2.31 on Docker — both print &lt;a&amp;&#039;&gt; for ENT_QUOTES line; issue expectation (&lt;a&amp;'&gt;) does not match current php-src/Zend. Pivoting.

  8. PurHur commented on Jul 10, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Runtime → PHP — starting this run (#16937 htmlspecialchars ENT_QUOTES apostrophe entity).

  9. PurHur commented on Jul 10, 2026

    @PurHur
    OwnerAuthor

    claim released: repro matches Zend on master (both print ' for ENT_QUOTES). Recommend close as fixed.

  10. PurHur commented on Jul 10, 2026

    @PurHur
    OwnerAuthor

    Triage (advanced stdlib 2026-07-10): repro green on master — htmlspecialchars("<a&'>", ENT_QUOTES) returns &lt;a&amp;&#039;&gt; on both Zend 8.2.31 and VM, matching php-src. Recommend close as stale.

  11. PurHur commented on Jul 10, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib Advanced — batch (issues #16937, #17696, #15410)

  12. PurHur commented on Jul 10, 2026

    @PurHur
    OwnerAuthor

    claim released: repro matches Zend 8.2.31 — both print ' for ENT_QUOTES. Pivoting to #17696.

  13. PurHur commented on Jul 11, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib Advanced — batch (issues #17821, #16937, #16925)

  14. PurHur commented on Jul 11, 2026

    @PurHur
    OwnerAuthor

    Triage (advanced stdlib 2026-07-11): repro already matches Zend PHP 8.2.31 — htmlspecialchars("<a&'>", ENT_QUOTES) prints &lt;a&amp;&#039;&gt; on both Zend and VM; compliance htmlspecialchars_flags.phpt expects &#039;. Recommend close as stale (issue Zend column incorrect). Pivoting batch to #17821 + #16925 only.

  15. PurHur commented on Jul 11, 2026

    @PurHur
    OwnerAuthor

    claim: cursor-agent-lane-c — starting this run (lane C; #17989 stale/green)

  16. PurHur commented on Jul 11, 2026

    @PurHur
    OwnerAuthor

    Unclaiming: repro matches Zend 8.2.31 on master — both emit &#039; for ENT_QUOTES (compliance htmlspecialchars_flags.phpt expects same). Issue stale per prior triage.

  17. PurHur commented on Jul 12, 2026

    @PurHur
    OwnerAuthor

    Stale vs php-src-strict (verified 2026-07-12): both Zend 8.2 Docker and VM emit &#039; for htmlspecialchars("<a&'>", ENT_QUOTES) — issue Zend column (literal ') was incorrect.

    ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php test/repro/maintainer_gap_htmlspecialchars_ent_flags.php'
    ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_htmlspecialchars_ent_flags.php'

    Output (both): first line &lt;a&amp;&#039;&gt;, second line &lt;a&amp;'&gt; (ENT_COMPAT). Matches compliance expectations; no VM drift to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machinebugSomething isn't workingenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions