#39361 [Opn]: more info...

From: Date: Fri, 03 Nov 2006 18:06:06 +0000
Subject: #39361 [Opn]: more info...
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-104329@lists.php.net to get a copy of this message
 ID:               39361
 User updated by:  christoph at ziegenberg dot de
-Summary:          mbstring function overloading - done although not
                   activated
 Reported By:      christoph at ziegenberg dot de
 Status:           Open
 Bug Type:         mbstring related
 Operating System: Win XP SP 2
 PHP Version:      5.2.0
 New Comment:

The value returned by ini_get() is correct (also the phpinfo() output),
but the behavior is wrong... I tested several other ini settings, but
the error seems to occur only with the mbstring function overloading.


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

[2006-11-03 17:28:47] christoph at ziegenberg dot de

Oh... I got the reason for it... really bad bug, might be critical and
influence other ini setting to:

1) run the script - it works. you get the error message for mb_strstr()
only:
Warning: mb_strstr() [function.mb-strstr]: Empty haystack in
W:\www\strstr\strstr.php on line 4

2) run a script in another directory with mbstring function overloading
activate* - the result is as expected:
Warning: mb_strstr() [function.mb-strstr]: Empty haystack in
W:\www\strstr\strstr.php on line 3
Warning: mb_strstr() [function.mb-strstr]: Empty haystack in
W:\www\strstr\strstr.php on line 4

3) now run the first script (NOT in the created directory!) and you get
the same error messages!
Warning: mb_strstr() [function.mb-strstr]: Empty haystack in
W:\www\strstr\strstr.php on line 3
Warning: mb_strstr() [function.mb-strstr]: Empty haystack in
W:\www\strstr\strstr.php on line 4


So the overloading setting is activated for the wrong directory!


* via .htaccess:
php_value mbstring.func_overload 6

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

[2006-11-03 14:55:55] christoph at ziegenberg dot de

wrong summary

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

[2006-11-03 14:54:41] christoph at ziegenberg dot de

Description:
------------
I got a new error message in PHP 5.2 when using mb_strstr() with an
empty string as haystack. So I wrote a testfile to compare the
behaviour of strstr() with mb_strstr().

Although mbstring function overloading is not enabled and the phpinfo()
output (in the same file, so there are no more changes via .htaccess)
says that all mbstring settings are the default settings, strstr() is
overloaded with mb_strstr(). 

phpinfo output:
---
Multibyte Support 	enabled
Multibyte string engine 	libmbfl
Multibyte (japanese) regex support 	enabled
Multibyte regex (oniguruma) version 	4.4.4
Multibyte regex (oniguruma) backtrack check 	On

mbstring extension makes use of "streamable kanji code filter and
converter", which is distributed under the GNU Lesser General Public
License version 2.1.

Directive	Local Value	Master Value
mbstring.detect_order	no value	no value
mbstring.encoding_translation	Off	Off
mbstring.func_overload	0	0
mbstring.http_input	pass	pass
mbstring.http_output	pass	pass
mbstring.internal_encoding	no value	no value
mbstring.language	neutral	neutral
mbstring.strict_detection	Off	Off
mbstring.substitute_character	no value	no value
---


Reproduce code:
---------------
<?php
//phpinfo();
strstr('', ',');
mb_strstr('', ',');
?>

Expected result:
----------------
Warning: strstr() [function.strstr]: Empty haystack in
W:\www\strstr\strstr.php on line 3

Warning: mb_strstr() [function.mb-strstr]: Empty haystack in
W:\www\strstr\strstr.php on line 4

Actual result:
--------------
Warning: mb_strstr() [function.mb-strstr]: Empty haystack in
W:\www\strstr\strstr.php on line 3

Warning: mb_strstr() [function.mb-strstr]: Empty haystack in
W:\www\strstr\strstr.php on line 4


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


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


Thread (14 messages)

« previous php.bugs (#104329) next »