From: philip at van-diemen-de-jel dot nl
Operating system: Linux
PHP version: 5.6.29
Package: unicodestring
Bug Type: Bug
Bug description:Incorrect entries in get_html_translation_table
Description:
------------
PHP-version: 5.6.29-0+deb8u1 (on Linux plesk4.duocast.net 3.16.0-4-amd64
#1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64)
Some entries obtained from get_html_translation_table have a missing
closing semicolon.
E.g. [8402] => &nvlt (should be <⃒)
[8421] => &bne
etc.
If you run the test script below (not the most sophisticated, but a
quicky), the invalid entries will be in red.
Test script:
---------------
$vec = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES |
ENT_HTML5);
foreach ($vec as $key => $value) {
$dec = Utf2code( $key );
if (substr($value,-1,1)!=';') echo "<br>[$dec] => &<span
class=red>".substr($value,1)."</span> = $value;";
else echo "<br>[$dec] => &".substr($value,1)." = $value";
}
function Utf2code( $latin ) {
$magic = 128;
$i = $cnt = 0;
while ($i < strlen($latin) ) {
$kar = substr( $latin, $i, 1 );
$num = ord( $kar );
if (strlen($latin)==1) return( $num );
if ($num >= $magic) {
$cnt++;
$mask = $magic; $len = $utf = 0;
while ($mask & $num) { $len++; $mask = $mask/2; };
$utf = ($mask-1) & $num;
$j = 1;
while ($j < $len) {
$kar = substr( $latin, $i+$j, 1 );
if ((192 & ord( $kar )) != 128) break;
$utf = ($utf * 64) + (63 & ord($kar));
$j++;
};
if (($j==$len) and ($len<=6)) { //Assume UTF
return( $utf );
};
};
$i++;
};
return( -1 );
};
Expected result:
----------------
A dump of the html (entity) translation table, with incomplete entries
flagged in red.
--
Edit bug report at https://bugs.php.net/bug.php?id=73817&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=73817&r=trysnapshot54
Try a snapshot (PHP 5.5):
https://bugs.php.net/fix.php?id=73817&r=trysnapshot55
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=73817&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73817&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73817&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73817&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73817&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73817&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73817&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73817&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=73817&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=73817&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73817&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73817&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73817&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73817&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73817&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73817&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73817&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73817&r=mysqlcfg
--
PECL development discussion Mailing List (http://pecl.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php