Bug #77607 [Opn->Nab]: mbfl library bug
| From: | nikic@php.net | Date: | Tue, 12 Feb 2019 09:56:41 +0000 |
| Subject: | Bug #77607 [Opn->Nab]: mbfl library bug | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-219523@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77607&edit=1
ID: 77607
Updated by: nikic@php.net
Reported by: legale dot legale at gmail dot com
Summary: mbfl library bug
-Status: Open
+Status: Not a bug
Type: Bug
Package: mbstring related
Operating System: Linux
PHP Version: 7.3.2
Block user comment: N
Private report: N
New Comment:
This looks correct to me. 0x003f is '?' which is the default substitution character
(though I think we should change the default to U+FFFD instead). See also http://php.net/manual/en/function.mb-substitute-character.php.
Previous Comments:
------------------------------------------------------------------------
[2019-02-11 22:23:07] legale dot legale at gmail dot com
Description:
------------
Processing bad utf-16 strings leads to unexpected source data changes.
Test script:
---------------
<?php
$bad_utf16be = pack("H*", "dc00dc00"); /* two 1 byte chars */
$good_utf16be = pack("H*", "d800dc00"); /* one 2 bytes char */
$utf16_string = $bad_utf16be . $good_utf16be;
/* take second and third char */
$second = mb_substr($utf16_string, 1, 1, "UTF-16BE");
$third = mb_substr($utf16_string, 2, 1, "UTF-16BE");
echo "\nactual:\n";
echo "second UTF-16BE char: 0x". bin2hex($second) . PHP_EOL;
echo "third UTF-16BE char: 0x". bin2hex($third) . PHP_EOL;
echo "\nexpected:\n";
echo "second UTF-16BE char: 0xdc00" . PHP_EOL;
echo "third UTF-16BE char: 0xd800dc00" . PHP_EOL;
Expected result:
----------------
expected:
second UTF-16BE char: 0xdc00
third UTF-16BE char: 0xd800dc00
Actual result:
--------------
actual:
second UTF-16BE char: 0x003f
third UTF-16BE char: 0xd800dc00
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77607&edit=1