From:             trollofdarkness at gmail dot com
Operating system: Debian 5 Lenny
PHP version:      5.4.8
Package:          ICONV related
Bug Type:         Bug
Bug description:iconv returns false when illegal character encountered

Description:
------------
Hi everyone,

I have been, since I think the version 5.3.x is out (and still with 5.4.8),

experiencing issues with iconv.


Especially, when an illegal character is encountered and the //IGNORE flag
is 
set on the target charset, the function returns FALSE instead of just
skipping 
this character.

This is problematic because if a single character in a 50 000 chars long
string 
is "illegal" then the output is nothing, just for one char... 

It does not happen with the TRANSLIT flag.

I experienced that with UTF8 (from) and ISO-8859-15 (to) charsets, I did
not 
test with other ones. Below is an example to reproduce the bug.

Note : I saw there are other bug reports about similar issues, but they're
all 
saying the string is cut... In my case, it literally returns false. So,
might be 
different? 

Test script:
---------------
<?php

$str = "
foo
è
foo
";
$result = iconv("UTF-8", "ISO-8859-15"."//IGNORE", $str);

var_dump($result); // false, instead of "foo ... foo"

?>

Expected result:
----------------
foo

foo


Actual result:
--------------
false

-- 
Edit bug report at https://bugs.php.net/bug.php?id=63450&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63450&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63450&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=63450&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63450&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63450&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63450&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63450&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63450&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63450&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63450&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=63450&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=63450&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63450&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63450&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63450&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63450&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63450&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63450&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63450&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63450&r=mysqlcfg

Reply via email to