Edit report at https://bugs.php.net/bug.php?id=61484&edit=1
ID: 61484
Comment by: php at s-hamel dot de
Reported by: juzna dot cz at gmail dot com
Summary: iconv //IGNORE option doesn't work anymore in
PHP5.4/5.5
Status: Open
Type: Feature/Change Request
Package: ICONV related
Operating System: Linux
PHP Version: 5.5.0
Block user comment: N
Private report: N
New Comment:
This issue seems to get fixed in PHP 5.5.26.
See http://git.php.net/?p=php-src.git;a=blob_plain;f=NEWS;hb=473ec539a1c3d242c8b171dd6a5a98fa17e05c13
- Iconv:
. Fixed bug #48147 (iconv with //IGNORE cuts the string). (Stas)
It would be great to have it fixed for PHP 5.4 as well.
Best regards
S.
Previous Comments:
------------------------------------------------------------------------
[2013-08-02 02:11:53] yohgaki@php.net
It seems usable.
$ php -r 'echo "\xc5\xbea\x01b\xed\xa0\x80c\xef\xbb\xbfd\xf4\x90\x80\x80e";' |
iconv -f 'UTF-8' -t 'UTF-16//IGNORE' | od -t x1
iconv: ä½ç½® 18
ã«ä¸æ£ãªå ¥åã·ã¼ã±ã³ã¹ãããã¾ã
0000000 ff fe 7e 01 61 00 01 00 62 00 63 00 ff fe 64 00
0000020 65 00
0000022
------------------------------------------------------------------------
[2013-08-02 02:01:05] yohgaki@php.net
iconv() 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;
}
------------------------------------------------------------------------
[2013-08-02 01:56:00] yohgaki@php.net
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.0
------------------------------------------------------------------------
[2012-11-02 13:45:19] valeriy-v at yandex dot ru
PHP Version 5.4.8 Centos
Linux 2.6.32-279.11.1.el6.x86_64 #1 SMP Tue Oct 16 15:57:10 UTC 2012 x86_64
------------------------------------------------------------------------
[2012-09-13 08:09:50] alec at alec dot pl
The bug exists in PHP 5.3.10 and Ubuntu EGLIBC 2.15-0ubuntu10
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=61484
--
Edit this bug report at https://bugs.php.net/bug.php?id=61484&edit=1