ID: 39400 Updated by: [EMAIL PROTECTED] -Reported By: christoph at ziegenberg dot de +Reported By: s dot masugata at mbg dot nifty dot com -Status: Assigned +Status: Feedback Bug Type: mbstring related Operating System: Win XP PHP Version: 5.2.0 Assigned To: hirokawa New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip Hi! :) I'm fixed this problem(just now). http://news.php.net/php.cvs/42277 Please, try snapshot. [tested spript]: <?php print("\n------[strpos (empty haystack):]---------\n"); var_dump( strpos( '', '' ) ); var_dump( mb_strpos( '', '' ) ); print("\n------[strpos (empty needle):]---------\n"); var_dump( strpos( '1', '' ) ); var_dump( mb_strpos( '1', '' ) ); print("\n------[strpos (needle > haystack):]---------\n"); var_dump( strpos('1', '100' ) ); var_dump( mb_strpos('1', '100' ) ); print("\n------[strpos (offest > haystack):]---------\n"); var_dump( strpos( '1', '1', 4 ) ); var_dump( mb_strpos( '1', '1', 4 ) ); print("\n------[stripos (empty haystack):]---------\n"); var_dump( stripos( '', '' ) ); var_dump( mb_stripos( '', '' ) ); print("\n------[stripos (empty needle):]---------\n"); var_dump( stripos( '1', '' ) ); var_dump( mb_stripos( '1', '' ) ); print("\n------[stripos (needle > haystack):]---------\n"); var_dump( stripos('1', '100' ) ); var_dump( mb_stripos('1', '100' ) ); print("\n------[stripos (offest > haystack):]---------\n"); var_dump( stripos( '1', '1', 4 ) ); var_dump( mb_stripos( '1', '1', 4 ) ); print("\n------[strrpos (empty haystack):]---------\n"); var_dump( strrpos( '', '' ) ); var_dump( mb_strrpos( '', '' ) ); print("\n------[strrpos (empty needle):]---------\n"); var_dump( strrpos( '1', '' ) ); var_dump( mb_strrpos( '1', '' ) ); print("\n------[strrpos (needle > haystack):]---------\n"); var_dump( strrpos('1', '100' ) ); var_dump( mb_strrpos('1', '100' ) ); print("\n------[strrpos (offest > haystack):]---------\n"); var_dump( strrpos( '1', '1', 4 ) ); var_dump( mb_strrpos( '1', '1', 4 ) ); print("\n------[strripos (empty haystack):]---------\n"); var_dump( strripos( '', '' ) ); var_dump( mb_strripos( '', '' ) ); print("\n------[strripos (empty needle):]---------\n"); var_dump( strripos( '1', '' ) ); var_dump( mb_strripos( '1', '' ) ); print("\n------[strripos (needle > haystack):]---------\n"); var_dump( strripos('1', '100' ) ); var_dump( mb_strripos('1', '100' ) ); print("\n------[strripos (offest > haystack):]---------\n"); var_dump( strripos( '1', '1', 4 ) ); var_dump( mb_strripos( '1', '1', 4 ) ); print("\n------[strstr (empty haystack):]---------\n"); var_dump( strstr( '', '' ) ); var_dump( mb_strstr( '', '' ) ); print("\n------[strstr (empty needle):]---------\n"); var_dump( strstr( '1', '' ) ); var_dump( mb_strstr( '1', '' ) ); print("\n------[strstr (needle > haystack):]---------\n"); var_dump( strstr('1', '100' ) ); var_dump( mb_strstr('1', '100' ) ); print("\n------[stristr (empty haystack):]---------\n"); var_dump( stristr( '', '' ) ); var_dump( mb_stristr( '', '' ) ); print("\n------[stristr (empty needle):]---------\n"); var_dump( stristr( '1', '' ) ); var_dump( mb_stristr( '1', '' ) ); print("\n------[stristr (needle > haystack):]---------\n"); var_dump( stristr('1', '100' ) ); var_dump( mb_stristr('1', '100' ) ); print("\n------[strrchr (empty haystack):]---------\n"); var_dump( strrchr( '', '' ) ); var_dump( mb_strrchr( '', '' ) ); print("\n------[strrchr (empty needle):]---------\n"); var_dump( strrchr( '1', '' ) ); var_dump( mb_strrchr( '1', '' ) ); print("\n------[substr_count (empty haystack):]---------\n"); var_dump( substr_count( '', '' ) ); var_dump( mb_substr_count( '', '' ) ); print("\n------[substr_count (empty needle):]---------\n"); var_dump( substr_count( '1', '' ) ); var_dump( mb_substr_count( '1', '' ) ); print("\n------[substr_count (needle > haystack):]---------\n"); var_dump( substr_count('1', '100' ) ); var_dump( mb_substr_count('1', '100' ) ); ?> [php.ini setting]: 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 [result]: ------[strpos (empty haystack):]--------- Warning: strpos(): Empty delimiter. in /usr/local/src/wk/39400.php on line 4 bool(false) Warning: mb_strpos(): Empty delimiter. in /usr/local/src/wk/39400.php on line 5 bool(false) ------[strpos (empty needle):]--------- Warning: strpos(): Empty delimiter. in /usr/local/src/wk/39400.php on line 8 bool(false) Warning: mb_strpos(): Empty delimiter. in /usr/local/src/wk/39400.php on line 9 bool(false) ------[strpos (needle > haystack):]--------- bool(false) bool(false) ------[strpos (offest > haystack):]--------- Warning: strpos(): Offset not contained in string. in /usr/local/src/wk/39400.php on line 16 bool(false) Warning: mb_strpos(): Offset not contained in string. in /usr/local/src/wk/39400.php on line 17 bool(false) ------[stripos (empty haystack):]--------- bool(false) bool(false) ------[stripos (empty needle):]--------- bool(false) bool(false) ------[stripos (needle > haystack):]--------- bool(false) bool(false) ------[stripos (offest > haystack):]--------- Warning: stripos(): Offset not contained in string. in /usr/local/src/wk/39400.php on line 33 bool(false) Warning: mb_stripos(): Offset not contained in string. in /usr/local/src/wk/39400.php on line 34 bool(false) ------[strrpos (empty haystack):]--------- bool(false) bool(false) ------[strrpos (empty needle):]--------- bool(false) bool(false) ------[strrpos (needle > haystack):]--------- bool(false) bool(false) ------[strrpos (offest > haystack):]--------- bool(false) bool(false) ------[strripos (empty haystack):]--------- bool(false) bool(false) ------[strripos (empty needle):]--------- bool(false) bool(false) ------[strripos (needle > haystack):]--------- bool(false) bool(false) ------[strripos (offest > haystack):]--------- bool(false) bool(false) ------[strstr (empty haystack):]--------- Warning: strstr(): Empty delimiter. in /usr/local/src/wk/39400.php on line 72 bool(false) Warning: mb_strstr(): Empty delimiter. in /usr/local/src/wk/39400.php on line 73 bool(false) ------[strstr (empty needle):]--------- Warning: strstr(): Empty delimiter. in /usr/local/src/wk/39400.php on line 76 bool(false) Warning: mb_strstr(): Empty delimiter. in /usr/local/src/wk/39400.php on line 77 bool(false) ------[strstr (needle > haystack):]--------- bool(false) bool(false) ------[stristr (empty haystack):]--------- Warning: stristr(): Empty delimiter. in /usr/local/src/wk/39400.php on line 89 bool(false) Warning: mb_stristr(): Empty delimiter. in /usr/local/src/wk/39400.php on line 90 bool(false) ------[stristr (empty needle):]--------- Warning: stristr(): Empty delimiter. in /usr/local/src/wk/39400.php on line 93 bool(false) Warning: mb_stristr(): Empty delimiter. in /usr/local/src/wk/39400.php on line 94 bool(false) ------[stristr (needle > haystack):]--------- bool(false) bool(false) ------[strrchr (empty haystack):]--------- bool(false) bool(false) ------[strrchr (empty needle):]--------- bool(false) bool(false) ------[substr_count (empty haystack):]--------- Warning: substr_count(): Empty substring. in /usr/local/src/wk/39400.php on line 123 bool(false) Warning: mb_substr_count(): Empty substring. in /usr/local/src/wk/39400.php on line 124 bool(false) ------[substr_count (empty needle):]--------- Warning: substr_count(): Empty substring. in /usr/local/src/wk/39400.php on line 127 bool(false) Warning: mb_substr_count(): Empty substring. in /usr/local/src/wk/39400.php on line 128 bool(false) ------[substr_count (needle > haystack):]--------- int(0) int(0) Thank you. Previous Comments: ------------------------------------------------------------------------ [2006-12-03 19:59:47] maik at primacom dot net I can confirm this. With this bugs, phpMyAdmin is also not working correctly if func_overload of the multibyte library is used. ------------------------------------------------------------------------ [2006-11-17 02:50:44] michael at labuschke dot de same on linux ------------------------------------------------------------------------ [2006-11-07 14:30:24] [EMAIL PROTECTED] Assigned to maintainer ------------------------------------------------------------------------ [2006-11-06 15:47:54] christoph at ziegenberg dot de Point "different behaviour between a function and the case-insensitive version" isn't right, I meant the difference between stripos() and strripos() (which behave equal in the mbstring version). ------------------------------------------------------------------------ [2006-11-06 13:21:54] s dot masugata at mbg dot nifty dot com Description: ------------ I posted a bug for the wrong behaviour of mb_strstr() compared to strstr() before - this has been fixed, but also the other functions behave different. Here a code to see more differences: - different behaviours between functions and the mbstring versions, - different error messages and - different behaviour between a function and the case-insensitive version Reproduce code: --------------- <?php print('stripos (empty haystack):<br />'); stripos('', ',', 0); mb_stripos('', ',', 0); print('<br />stripos (offest > length):<br />'); stripos('1', ',', 3); mb_stripos('1', ',', 3); print('<br />strripos (empty haystack):<br />'); strripos('', ',', 0); mb_strripos('', ',', 0); print('<br />strripos (offest > length):<br />'); strripos('1', ',', 3); mb_strripos('1', ',', 3); print('<br />stristr (empty haystack):<br />'); stristr('', ','); mb_stristr('', ','); print('<br />strrichr (empty haystack):<br />'); strrchr('', ','); mb_strrchr('', ','); ?> Expected result: ---------------- stripos (empty haystack): stripos (offest > length): [same error message, dunno which is the better one - they mean the same, but it would be better to get the same text. or no error as in strripos(), see below.] strripos (empty haystack): strripos (offest > length): [same as for stripos() - strripos() returns no error here] stristr (empty haystack): strrichr (empty haystack): Actual result: -------------- stripos (empty haystack): Warning: mb_stripos() [function.mb-stripos]: Empty haystack in W:\www\mb_functions.php on line 4 stripos (offest > length): Warning: stripos() [function.stripos]: Offset not contained in string. in W:\www\mb_functions.php on line 7 Warning: mb_stripos() [function.mb-stripos]: Offset is out of range in W:\www\mb_functions.php on line 8 strripos (empty haystack): Warning: mb_strripos() [function.mb-strripos]: Empty haystack in W:\www\mb_functions.php on line 13 strripos (offest > length): Warning: mb_strripos() [function.mb-strripos]: Offset is out of range in W:\www\mb_functions.php on line 17 stristr (empty haystack): Warning: mb_stristr() [function.mb-stristr]: Empty haystack in W:\www\mb_functions.php on line 21 strrichr (empty haystack): Warning: mb_strrchr() [function.mb-strrchr]: Empty haystack in W:\www\mb_functions.php on line 25 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39400&edit=1