php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39361 mbstring function overloading - done although not activated
Submitted: 2006-11-03 14:54 UTC Modified: 2006-12-22 02:58 UTC
Votes:7
Avg. Score:4.4 ± 0.7
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:0 (0.0%)
From: s dot masugata at digicom dot dnp dot co dot jp Assigned: masugata (profile)
Status: Closed Package: mbstring related
PHP Version: 5.2.0 OS: Win XP SP 2
Private report: No CVE-ID: None
 [2006-11-03 14:54 UTC] s dot masugata at digicom dot dnp dot co dot jp
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-03 17:28 UTC] 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 18:06 UTC] christoph at ziegenberg dot de
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.
 [2006-12-09 17:59 UTC] christoph at ziegenberg dot de
You can download an example here:
http://www.ziegenberg.de/phpbug_39361.zip
 [2006-12-21 18:15 UTC] christoph at ziegenberg dot de
The example I posted works fine now (Win XP SP2).
Thanks!
 [2006-12-22 02:58 UTC] masugata@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Thank you for test. :)

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC