Skip to content

Stdlib: html_entity_decode() numeric entities &#N;/&#xN; — not decoded (ext/standard/html.c) #11510

Description

@PurHur

Summary

html_entity_decode() leaves numeric character references (A, A) unchanged. Zend decodes them to the corresponding UTF-8 character (A). Named-entity gaps are tracked separately (#10763, #10519); this issue is decimal/hex numeric refs only.

php-src reference: ext/standard/html.c (php_unescape_html_entities, numeric entity branch).

PHP implementation target: ext/standard/ HTML helpers (VmHtml / string builtins) — port decode table logic in PHP; no permanent C-only shortcut in runtime/.

Repro

./script/docker-exec.sh -- php test/repro/issue_html_entity_decode_numeric.php          # Zend: A / A
./script/docker-exec.sh -- php bin/vm.php test/repro/issue_html_entity_decode_numeric.php  # VM: A / A

Minimal:

html_entity_decode('A', ENT_QUOTES | ENT_HTML5);   // Zend: 'A'; VM: 'A'
html_entity_decode('A', ENT_QUOTES | ENT_HTML5);  // Zend: 'A'; VM: 'A'

Expected (php-src-strict)

  • Decimal &#digits; and hex &#xhex; / &#Xhex; decode to UTF-8 bytes.
  • Invalid/out-of-range numeric refs follow Zend (typically leave ref or emit warning per php-src).
  • Works with combined ENT_* flag ints when those flags are accepted.

Done when

  • test/repro/issue_html_entity_decode_numeric.php green on php bin/vm.php.
  • Targeted compliance guard under test/compliance/ or test/repro/.

Activity

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 machineenhancementNew 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