Req #78020 [NEW]: A more flexible 'html_entity_decode' based on tries
| From: | stvar at yahoo dot com | Date: | Thu, 16 May 2019 10:52:40 +0000 |
| Subject: | Req #78020 [NEW]: A more flexible 'html_entity_decode' based on tries | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-220864@lists.php.net to get a copy of this message | ||
From: stvar at yahoo dot com
Operating system:
PHP version: Next Minor Version
Package: Strings related
Bug Type: Feature/Change Request
Bug description:A more flexible 'html_entity_decode' based on tries
Description:
------------
Dear maintainers,
It is quite possible and feasible to have a more flexible
'html_entity_decode' that handles properly the named char
references that, for historical reasons, are allowed to
not be terminated with semicolon [1].
To sustain my claim, I invite you to examine Html-Cref
[2] -- a project I developed recently that implements
several named character reference *parsers* based on
tries instead of hash tables.
Upon bringing into Html-Cref's framework PHP's function
'resolve_named_entity_html' and an adapted hash table
'ent_ht_html5' (all these according to the patch file [3];
the size of 'ent_ht_html5' was preserved), the standalone
binary obtained 'html-cref' is about 25% bigger then the
one built with e.g. the 'etrie' parser: 203K vs. 163K.
The measurements done (`html-cref-test --cycles') show
that the newly added function 'html_cref_php_parse' in
'src/html_cref_php.c' runs about 4% slower than either
of the trie-based parsers 'iwtrie', 'ietrie', 'etrie'
and 'wtrie' on a 64-bit Intel Core I5-3210M machine.
Sincerely,
Stefan Vargyas.
PS: this post is a slightly changed version of [4]. Hereby
I hope to catch your attention and open a discussion about
an improved 'html_entity_decode'.
[1] 12.2 Parsing HTML documents:
12.2.5.73 Named character reference state
https://html.spec.whatwg.org/#named-character-reference-state
[2] Html-Cref: Fast HTML Character References Decoder
https://github.com/stvar/html-cref
[3] html-cref-php.patch
https://gist.github.com/stvar/df320f55d83cedac9fd7261256d20906
[4] https://bugs.php.net/bug.php?id=77769#1557609156
--
Edit bug report at https://bugs.php.net/bug.php?id=78020&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=78020&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=78020&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=78020&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=78020&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78020&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78020&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78020&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78020&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78020&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78020&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78020&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78020&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78020&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78020&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=78020&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78020&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78020&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78020&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78020&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78020&r=mysqlcfg