get_html_translation_table() inconsistent results with ENT_XHTML?
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
The following code:
<?php
print_r(get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES | ENT_SUBSTITUTE | ENT_XHTML, "UTF-8"));
print_r(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES | ENT_SUBSTITUTE | ENT_XHTML, "UTF-8"));
Resulted in this output:
Array
(
["] => "
[&] => &
['] => '
[<] => <
[>] => >
)
Array
(
["] => "
[&] => &
['] => '
[<] => <
[>] => >
[ ] =>
// ...
// ...
)
But I expected the specialchars table to be a subset of the entities table. The single quotes in the entities table is substituted using the decimal notation, while it uses the html5 named entity notation in the specialchars table.
PHP Version
PHP 5.4 to PHP 8.2
Operating System
mint/ubuntu 22.04
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the get_html_translation_table() calls from the issue on a supported PHP build, comparing HTML_SPECIALCHARS and HTML_ENTITIES with ENT_XHTML. Trace the implementation and existing tests for these flags; done means the specialchars table has consistent quote mappings with the entities table, including the single-quote representation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100