#33506 [NEW]: iconv_substr_count

2005-06-29 Thread markus dot lervik at necora dot fi
From: markus dot lervik at necora dot fi
Operating system: Irrelevant
PHP version:  5.1.0b2
PHP Bug Type: Feature/Change Request
Bug description:  iconv_substr_count

Description:

It would be very nice to have an iconv_substr_count -function too, as we
have iconv_substr, iconv_strlen, iconv_strpos and iconv_strrpos. 
Naturally you can (and I have) write a recursive PHP function that handles
it, but I'm assuming it'd be a lot more efficent if written in C.

I did attempt writing it myself, but unfortunately my C and the PHP API
-knowledge is more than limited :(


-- 
Edit bug report at http://bugs.php.net/?id=33506&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33506&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33506&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33506&r=trysnapshot51
Fixed in CVS:http://bugs.php.net/fix.php?id=33506&r=fixedcvs
Fixed in release:http://bugs.php.net/fix.php?id=33506&r=alreadyfixed
Need backtrace:  http://bugs.php.net/fix.php?id=33506&r=needtrace
Need Reproduce Script:   http://bugs.php.net/fix.php?id=33506&r=needscript
Try newer version:   http://bugs.php.net/fix.php?id=33506&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33506&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=33506&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=33506&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=33506&r=submittedtwice
register_globals:http://bugs.php.net/fix.php?id=33506&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33506&r=php3
Daylight Savings:http://bugs.php.net/fix.php?id=33506&r=dst
IIS Stability:   http://bugs.php.net/fix.php?id=33506&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33506&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33506&r=float
No Zend Extensions:  http://bugs.php.net/fix.php?id=33506&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33506&r=mysqlcfg


#33268 [Csd->Opn]: iconv_strlen works only with a parameter of < 3 in length

2005-06-08 Thread markus dot lervik at necora dot fi
 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)



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


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


#33268 [NEW]: iconv_strlen works only with a parameter of < 3 in length

2005-06-07 Thread markus dot lervik at necora dot fi
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:
---


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