Bug #81362 [NEW]: iconv UTF-8//IGNORE fails to strip "\xF5\x80\x80\x80"
| From: | divinity76 at gmail dot com | Date: | Sun, 15 Aug 2021 15:34:21 +0000 |
| Subject: | Bug #81362 [NEW]: iconv UTF-8//IGNORE fails to strip "\xF5\x80\x80\x80" | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-235830@lists.php.net to get a copy of this message | ||
From: divinity76 at gmail dot com
Operating system:
PHP version: 8.0.9
Package: ICONV related
Bug Type: Bug
Bug description:iconv UTF-8//IGNORE fails to strip "\xF5\x80\x80\x80"
Description:
------------
it does reproduce on "PHP8.0.3 + iconv 2.28 + Ubuntu 20.04",
it also reproduce on 3v4l.org everywhere from PHP5.6.0 to PHP8.0.9
inclusive, but unknown iconv/OS: https://3v4l.org/1b4G8
(the string also appears to trigger a bug in mb_check_encoding() that
was fixed in 5.6.0?)
interestingly it does *not* reproduce on "PHP7.3.7-for-cygwin + iconv
1.0 + Windows 10", there it correctly strip the string down to string(3)
"PHP"
it's possible that it's the result of a bug introduced sometime after
iconv 1.0 and <= iconv 2.28?
Test script:
---------------
<?php
$invalid_utf8="\xF5\x80\x80\x80PHP";
$should_be_valid_utf8=iconv("UTF-8","UTF-8//IGNORE",$invalid_utf8);
var_dump($should_be_valid_utf8,bin2hex($should_be_valid_utf8),mb_check_encoding($should_be_valid_utf8));
Expected result:
----------------
string(3) "PHP"
string(6) "504850"
bool(true)
Actual result:
--------------
string(7) "����PHP"
string(14) "f5808080504850"
bool(false)
--
Edit bug report at https://bugs.php.net/bug.php?id=81362&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81362&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81362&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81362&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81362&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81362&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81362&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81362&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81362&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81362&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81362&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81362&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81362&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81362&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81362&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81362&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81362&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81362&r=mysqlcfg