|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-03-22 23:59 UTC] juzna dot cz at gmail dot com
Description:
------------
When adding "//IGNORE" to target encoding in iconv function, wrong characters
should be skipped. This worked in PHP 5.3, but doesn't work anymore in 5.4.
I just compiled 5.3.10, where it works fine. Doesn't work on 5.4.0 nor on 5.4.1-
RC1.
Test script:
---------------
var_dump(iconv('UTF-8', 'UTF-16//IGNORE', "\xc5\xbea\x01b\xed\xa0\x80c\xef\xbb\xbfd\xf4\x90\x80\x80e"));
Expected result:
----------------
string(18) "��~abc��de"
Actual result:
--------------
bool(false)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 06:00:02 2025 UTC |
Fedora19 x86_64's php php > var_dump(iconv('UTF-8', 'UTF-16//IGNORE', "\xc5\xbea\x01b\xed\xa0\x80c\xef\xbb\xbfd\xf4\x90\x80\x80e")); Notice: iconv(): Detected an illegal character in input string in php shell code on line 1 bool(false) php > echo phpversion(); 5.5.0iconv() returns FALSE when there is error. I haven't checked if out_buffer is usable, though. ext/iconv/iconv.c err = php_iconv_string(in_buffer, (size_t)in_buffer_len, &out_buffer, &out_len, out_charset, in_charset); _php_iconv_show_error(err, out_charset, in_charset TSRMLS_CC); if (err == PHP_ICONV_ERR_SUCCESS && out_buffer != NULL) { RETVAL_STRINGL(out_buffer, out_len, 0); } else { if (out_buffer != NULL) { efree(out_buffer); } RETURN_FALSE; }