From: markus dot lervik at necora dot fi
Operating system: SuSE Linux 9.2
PHP version: 5.0.3
PHP Bug Type: ICONV related
Bug description: iconv_strlen works only with a parameter of < 3 in length
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:
[EMAIL PROTECTED]:~> 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:
[EMAIL PROTECTED]:~> 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 bug report at http://bugs.php.net/?id=33268&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33268&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=33268&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=33268&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33268&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33268&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33268&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33268&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33268&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33268&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33268&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=33268&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=33268&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33268&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33268&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33268&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33268&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33268&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33268&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33268&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33268&r=mysqlcfg