From: rq at akl dot lt Operating system: Linux PHP version: 4.3.9 PHP Bug Type: ICONV related Bug description: iconv() fails to output an error even if it cannot convert a string
Description: ------------ It's a duplicate of Bug #29852, which I cannot comment because it's marked as "Bogus", which it's not I'm using iconv() for some charset conversions, and, before converting anything to users' supplied charset, i use iconv() to check whether it would convert flawlessly. And I noticed, that iconv() never returns any error if at least the first character in the array given for conversion, is convertable. However, i think it's a bug somewhere in PHP, because the iconv(1) console command outputs an error in both similar cases: [EMAIL PROTECTED]:~ $ echo "rūta" > r [EMAIL PROTECTED]:~ $ iconv -futf-8 -tascii r riconv: illegal input sequence at position 1 ^^ note the "r" here. [EMAIL PROTECTED]:~ $ echo "ūta" > r [EMAIL PROTECTED]:~ $ iconv -futf-8 -tascii r iconv: illegal input sequence at position 0 [EMAIL PROTECTED]:~ $ echo "ruta" > r [EMAIL PROTECTED]:~ $ iconv -futf-8 -tascii r ruta Reproduce code: --------------- I wrote a small testcase script to demonstrate this issue. It's located at: http://jazz.lma.lt/~rq/iconv.php and source is at: http://jazz.lma.lt/~rq/iconv.phps. For example, check out these two links: http://jazz.lma.lt/~rq/iconv.php?text=r%C3%BBta&charset=ascii&submit= http://jazz.lma.lt/~rq/iconv.php?text=%C3%BBta&charset=ascii&submit= The only difference in them is an "r" letter in the beginning of the "text" variable. And in case it exists in "text", no errors are reported. Expected result: ---------------- In both cases, iconv() should have reported an error. Actual result: -------------- iconv() did not return an error in the first case, when there was an ASCII letter before any unconvertable strings. -- Edit bug report at http://bugs.php.net/?id=31030&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31030&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31030&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31030&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31030&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31030&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31030&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31030&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31030&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31030&r=support Expected behavior: http://bugs.php.net/fix.php?id=31030&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31030&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31030&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31030&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31030&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31030&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31030&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31030&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31030&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=31030&r=mysqlcfg