ID: 39400
User updated by: christoph at ziegenberg dot de
Reported By: christoph at ziegenberg dot de
Status: Open
Bug Type: mbstring related
Operating System: Win XP
PHP Version: 5.2.0
New Comment:
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).
Previous Comments:
------------------------------------------------------------------------
[2006-11-06 13:21:54] christoph at ziegenberg dot de
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