php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39364 mb_strstr() behavior differs from strstr()
Submitted: 2006-11-03 17:38 UTC Modified: 2006-11-03 20:38 UTC
From: christoph at ziegenberg dot de Assigned:
Status: Closed Package: mbstring related
PHP Version: 5.2.0 OS: Win XP SP 2
Private report: No CVE-ID: None
 [2006-11-03 17:38 UTC] christoph at ziegenberg dot de
Description:
------------
as described in the more important bug #39361 i compared strstr() and mb_strstr().

mb_strstr() produces the following error when using an empty haystack:

    Warning: mb_strstr() [function.mb-strstr]: 
    Empty haystack in X on line Y

but strstr() doesn't.

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

Expected result:
----------------
no error message - because haystack does not contain needle, so the function should return false, as described in the documentation. the different behavior produces a lot of errors when using function overloading (although i know using it is not a good idea... ;).

Actual result:
--------------
Warning: mb_strstr() [function.mb-strstr]: Empty haystack in X on line Y

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-03 19:56 UTC] iliaa@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

dupe of 39361
 [2006-11-03 20:19 UTC] christoph at ziegenberg dot de
No, that is not the same bug!

Bug #39361 is about that the ini settings for function overloading are "cached" and still active when changing the directory.

Bug #39364 is about the different behavior of mb_strstr() and strstr().

I found bug number one when checking the second one, but that not the same bug... so which one did you fix?
 [2006-11-03 20:38 UTC] iliaa@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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 02:01:28 2024 UTC