ID:               33268
 User updated by:  markus dot lervik at necora dot fi
 Reported By:      markus dot lervik at necora dot fi
-Status:           Closed
+Status:           Open
 Bug Type:         ICONV related
 Operating System: SuSE Linux 9.2
 PHP Version:      5.0.3
 New Comment:

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)


Previous Comments:
------------------------------------------------------------------------

[2005-06-08 02:38:56] [EMAIL PROTECTED]

And in HEAD (upcoming 5.1) there is no problem.


------------------------------------------------------------------------

[2005-06-08 00:51:52] scott at slerman dot net

I confirmed this problem on Fedora using PHP 5.0.4 and Apache 2.0.54.
On Windows/PHP 5.0.4 I get

Notice: iconv_strlen(): Unknown error (9) in C:\PHP\test\iconv.php on
line 1

On Fedora/PHP 5.0.4 CLI I get

Notice: iconv_strlen(): Unknown error (25) in /home/scott/test
files/iconv.php on line 1

------------------------------------------------------------------------

[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:

[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 this bug report at http://bugs.php.net/?id=33268&edit=1

Reply via email to