ID:               38577
 User updated by:  php at diptyque dot net
 Reported By:      php at diptyque dot net
 Status:           Open
 Bug Type:         mbstring related
 Operating System: FreeBSD 4.4
 PHP Version:      4.4.4
 New Comment:

Oops, my mistake. You should swap Expected and Actual 
results. Actual result is int(18) !? Expected result is 
int(19).


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

[2006-08-24 12:28:30] php at diptyque dot net

Granted I could not reproduce either this bug using a WAMP 
setup but did you follow the hyperlink I gave on my 
FreeBSD-based server, where you can consistently replicate 
this bug on each GET request?

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

[2006-08-24 11:03:09] [EMAIL PROTECTED]

Can't reproduce. I get int(19) in all cases.

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

[2006-08-24 10:17:16] php at diptyque dot net

Description:
------------
Changing internal character encoding during script 
execution apparently affects mbstring function overloading: 
strlen() returns the length of the string based on current 
internal encoding although function overloading is disabled 
(either through php.ini, vhost and/or .htaccess settings.)

On apache 1.3 startup or graceful restart, script may run 
as expected but repeated requests would inevitably trigger 
the bug -- on my server setup, MediaWiki cannot run 
reliably because of this weird behavior :-/

The bug is not triggered when I do run this script under 
other SAPIs such as CLI or FastCGI.

./configure --with-apxs=/usr/local/apache/bin/apxs
--with-mysql=/usr/local --with-openssl=/usr/local/apache
--with-gd=/usr/local --with-zlib --with-bz2 --with-xml
--with-freetype-dir=/usr/local --with-ttf --with-imap 
--with-curl
--with-jpeg-dir=/usr/local --with-png-dir=/usr/local
--with-readline=/usr/local --prefix=/usr/local/apache
--with-config-file-path=/usr/local/apache/etc 
--enable-mbstring
--enable-mbregex --enable-zend-multibyte
; configure line

Reproduce code:
---------------
http://www.diptyque.net/bugs/mbinfo.php
; running PHP 4.4 as an apache module
; display charset is set to UTF-8

; when internal encoding is set to UTF-8,
; strlen() returns the wrong character count
; (e.g. 18 instead of 19)

http://www.diptyque.net/bugs/mbinfo.phps
; source code


Expected result:
----------------
string(10) "ISO-8859-1"
string(10) "ISO-8859-1"
string(1) "0"
string(19) "Méthodes de codage"
int(19)
--
bool(true)
string(5) "UTF-8"
string(10) "ISO-8859-1"
string(1) "0"
string(19) "Méthodes de codage"
int(18)
--
bool(true)
string(10) "ISO-8859-1"
string(10) "ISO-8859-1"
string(1) "0"
string(19) "Méthodes de codage"






Actual result:
--------------
string(10) "ISO-8859-1"
string(10) "ISO-8859-1"
string(1) "0"
string(19) "Méthodes de codage"
int(19)
--
bool(true)
string(5) "UTF-8"
string(10) "ISO-8859-1"
string(1) "0"
string(19) "Méthodes de codage"
int(19)
--
bool(true)
string(10) "ISO-8859-1"
string(10) "ISO-8859-1"
string(1) "0"
string(19) "Méthodes de codage"





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


-- 
Edit this bug report at http://bugs.php.net/?id=38577&edit=1

Reply via email to