|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-11-06 15:47 UTC] christoph at ziegenberg dot de
[2006-12-22 07:47 UTC] masugata@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 21:00:01 2025 UTC |
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