|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37773 iconv_substr() gives "Unknown error" when string length = 1"
Submitted: 2006-06-10 00:01 UTC Modified: 2006-11-15 18:35 UTC
From: dave at dgx dot cz Assigned:
Status: Closed Package: ICONV related
PHP Version: 5.1.4 OS:
Private report: No CVE-ID: None
 [2006-06-10 00:01 UTC] dave at dgx dot cz
(Similar to bug #34757).

When input string length = 1, iconv_substr() produces "Unknown error (0)" and returns FALSE.

Reproduce code:
$s = 'x';
$s = iconv_substr($s, 0, 1, 'UTF-8');


Expected result:
string(1) "x"

Actual result:

and Notice: iconv_substr() [function.iconv-substr.html]: Unknown error (0) in ...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-10 00:03 UTC] dave at dgx dot cz
Of course, title is: iconv_substr() gives "Unknown error" when string length = 1" 

Operating system: Windows XP.

It is not my error - has bugs!
 [2006-06-12 10:40 UTC]
Please try using this CVS snapshot:
For Windows:

 [2006-06-12 14:59 UTC]

the patch removes a strange 'switch (errno)' that I don't really know why it was there and adds a check for _php_iconv_appendl()
 [2006-07-06 02:41 UTC]
The switch clause is needed so that illegal multibyte occurrences would be detected per specification. I'm going to look into this one.
 [2006-11-15 18:35 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 19 18:01:30 2024 UTC