#33268 [Ver->Csd]: iconv_strlen works only with a parameter of < 3 in length
| From: | iliaa@php.net | Date: | Wed, 08 Jun 2005 23:51:57 +0000 |
| Subject: | #33268 [Ver->Csd]: iconv_strlen works only with a parameter of < 3 in length | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-80080@lists.php.net to get a copy of this message | ||
ID: 33268
Updated by: iliaa@php.net
Reported By: markus dot lervik at necora dot fi
-Status: Verified
+Status: Closed
Bug Type: ICONV related
Operating System: *
PHP Version: 5.* (2005-06-08)
New Comment:
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
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2005-06-08 17:31:34] sniper@php.net
Reproduced (having error_reporting = E_ALL helps :)
------------------------------------------------------------------------
[2005-06-08 12:42:47] markus dot lervik at necora dot fi
My initial bug report regarded 5.0.3 and the latest HEAD from yesterday
(2005-06-07).
I do still get the same problem with latest 5.1 (php-src) from CVS
(checked out just 15 minutes ago, 2005-06-08), both with the
glibc-provided iconv and the external libiconv (version 1.9.2)
<?php
$a = iconv_strlen("");
var_dump($a);
$b = iconv_strlen("a");
var_dump($b);
$c = iconv_strlen("aa");
var_dump($c);
$d = iconv_strlen("aaa");
var_dump($d);
$e = iconv_strlen("aaaa");
var_dump($e);
?>
Notice: iconv_strlen() [function.iconv-strlen]: Unknown error (2) in
/usr/local/apache/htdocs/test2.php on line 2
bool(false)
Notice: iconv_strlen() [function.iconv-strlen]: Unknown error (2) in
/usr/local/apache/htdocs/test2.php on line 5
bool(false)
Notice: iconv_strlen() [function.iconv-strlen]: Unknown error (2) in
/usr/local/apache/htdocs/test2.php on line 8
bool(false)
int(3)
int(4)
------------------------------------------------------------------------
[2005-06-08 00:28:48] markus dot lervik at necora dot fi
Description:
------------
iconv_strlen seems to have a peculiar bug. It doesn't work when the
string searched is less than three characters long (or an empty
string), but reports
Notice: iconv_strlen() [function.iconv-strlen]: Unknown error (2) in
/usr/local/apache/htdocs/test2.php on line 7
This is tested on PHP 5.0.3 and 5.1 from CVS (2005-06-07), tested with
the built-in (glibc 2.3.3) iconv and libiconv 1.9.2 from gnu.org.
This problem doesn't seem to surface on my Debian 3.1 development
server, but I get it on my SuSE 9.2 desktop.
I have tried to set the encodings with iconv_set_encoding() and I have
tried to set the encoding as a parameter to iconv_strlen(), both
produce the same error.
The other iconv-functions (iconv_strpos, iconv_substr, iconv_strrpos)
work fine.
Since the iconv-functions do not seem to work from the commandline
(produces an Unknown error(29)), I cannot get a proper strace (strace
seems to say that iconv is trying to seek on /dev/pts/5, which
apparently is impossible). It doesn't crash apache either, so I'm not
sure where I'd grab the backtrace.
List of modules:
mle@linux:~> php -m
[PHP Modules]
bz2
ctype
curl
dom
exif
gd
iconv
libxml
openssl
pcre
PDO
pdo_sqlite
pgsql
posix
session
SimpleXML
soap
SPL
standard
tokenizer
wddx
xml
xmlrpc
xsl
zlib
[Zend Modules]
PHP version:
mle@linux:~> php --version
PHP 5.1.0-dev (cli) (built: Jun 7 2005 21:30:37) (DEBUG)
Copyright (c) 1997-2005 The PHP Group
Zend Engine v2.1.0-dev, Copyright (c) 1998-2004 Zend Technologies
configure line:
'./configure' '--with-apxs=/usr/local/apache/bin/apxs'
'--with-openssl'
'--with-curl' '--with-zlib' '--with-bz2' '--enable-exif'
'--with-gd'
'--with-pgsql=/usr' '--enable-soap' '--enable-wddx'
'--without-sqlite'
'--with-xmlrpc' '--with-xsl' '--with-jpeg-dir=/usr/local/'
'--with-png-dir=/usr/local/' '--without-mysql' '--with-xslt-sablot'
'--with-iconv=/usr/local/' '--enable-debug'
Reproduce code:
---------------
<?php
$x = iconv_strlen("");
var_dump($x);
?>
Expected result:
----------------
bool(false)
Actual result:
--------------
Notice: iconv_strlen() [function.iconv-strlen]: Unknown error (2) in
/usr/local/apache/htdocs/test2.php on line 2
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33268&edit=1