summaryrefslogtreecommitdiff
path: root/ext/standard/basic_functions.h
diff options
context:
space:
mode:
authorGustavo André dos Santos Lopes <cataphract@php.net>2010-10-10 19:04:59 +0000
committerGustavo André dos Santos Lopes <cataphract@php.net>2010-10-10 19:04:59 +0000
commit7aa43a8d834e386a1b38490644983c0c3587dcd5 (patch)
tree7c6ec23ac08818bd24463bf3dae8bbb873904d60 /ext/standard/basic_functions.h
parentb1d5cf7348105cb8205b0fe7c54494b1fefd80cf (diff)
downloadphp-git-7aa43a8d834e386a1b38490644983c0c3587dcd5.tar.gz
- Revamp of the decoding portion of html.c.
- Dramatic improvements on the performance of html_entity_decode and htmlspecialchars_decode, as the string is now traversed only once. Speedups of 20 to 25 times with Windows release builds and a ~250 characters string (for 2nd and subsequent calls). - Consistent behavior on html_entity_decode. For instance, the entity in "&&lt;" would be decoded, but not "&&#233;". Not anymore. The code path for "basic" and non-basic entities is now mostly shared. - Code of html_entity_decode and htmlspecialchars_decode is now shared. - [DOC] More consistent behavior of htmlspecialchars_decode. Instead of translating only &lt;, &gt;, &amp;, &quot;, &#039; and &#39;, now e.g. &#34;, &apos;, &#0039;, &#x27;, etc. are also decoded. - [DOC] Previous translation of unicode code points in numerical entities was seriously broken. When the code points for some character were not the same in unicode and the target encoding, the behavior could be an erroneous translation (e.g. 0x80-0xA0 in win-1252) or no translation at all. Added unicode translation tables for all single-byte encodings. Entities are not translated for multi-byte entities, except for ASCII characters whose code points are shared. We could add the huge translation tables (several thousand elements) for those encodings in the future. - Fixed numerical entities that after # had text accepted by strcol being accepted. - Much more commented and well-structured code... - Tests for get_html_translation_table()) are broken. I stared fixing the tests, but then I realized it was completely helpless because get_html_translation_table() is broken by not handling multi-byte characters correctly.
Diffstat (limited to 'ext/standard/basic_functions.h')
-rw-r--r--ext/standard/basic_functions.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
index 4498e6cf8f..edc5846e0a 100644
--- a/ext/standard/basic_functions.h
+++ b/ext/standard/basic_functions.h
@@ -220,6 +220,10 @@ typedef struct _php_basic_globals {
HashTable *user_filter_map;
+ /* html.c */
+ /* map entities to characters. Stores hash table pointers for each charset */
+ HashTable *inverse_ent_maps;
+
/* file.c */
#if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T)
mbstate_t mblen_state;