php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69840 iconv_substr() doesn't work with UTF-16BE
Submitted: 2015-06-15 16:03 UTC Modified: 2015-06-17 07:40 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: jan dot slabon at setasign dot com Assigned: kalle (profile)
Status: Closed Package: ICONV related
PHP Version: 7.0.0alpha1 OS: Windows 7 Pro
Private report: No CVE-ID: None
 [2015-06-15 16:03 UTC] jan dot slabon at setasign dot com
Description:
------------
The iconv_substr() function returns false instead of the expected substring.

I just tried UTF-16LE which works:

php -r "var_dump(iconv_substr(\"a\x00b\x00\", 0, 1, 'UTF-16LE'));"
string(2) "a\x00"

Also iconv_strlen() works as expected.

Test script:
---------------
var_dump(iconv_substr("\x00a\x00b", 0, 1, 'UTF-16BE'));

Expected result:
----------------
string(2) "\x00a"

Actual result:
--------------
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-15 21:44 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2015-06-15 21:44 UTC] cmb@php.net
Confirmed: <http://3v4l.org/C9im4>.
 [2015-06-17 07:40 UTC] kalle@php.net
Automatic comment on behalf of kalle
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ff9e290438afc4c9e3d69bc88e37fd56267fe898
Log: Fixed bug #69840 (iconv_substr() doesn't work with UTF-16BE)
 [2015-06-17 07:40 UTC] kalle@php.net
-Status: Verified +Status: Closed
 [2015-06-17 07:40 UTC] kalle@php.net
-Status: Closed +Status: Verified -Assigned To: +Assigned To: kalle
 [2015-06-17 07:40 UTC] kalle@php.net
Should be fixed and available in Alpha 2
 [2015-06-17 07:40 UTC] kalle@php.net
-Status: Verified +Status: Closed
 [2015-06-23 18:04 UTC] ab@php.net
Automatic comment on behalf of kalle
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ff9e290438afc4c9e3d69bc88e37fd56267fe898
Log: Fixed bug #69840 (iconv_substr() doesn't work with UTF-16BE)
 [2016-07-20 11:38 UTC] davey@php.net
Automatic comment on behalf of kalle
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ff9e290438afc4c9e3d69bc88e37fd56267fe898
Log: Fixed bug #69840 (iconv_substr() doesn't work with UTF-16BE)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 04:01:31 2024 UTC