|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44010 Function: strstr() and stristr()
Submitted: 2008-02-01 01:52 UTC Modified: 2008-02-01 10:26 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: diemuzi at gmail dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.2.5 OS: Archlinux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: diemuzi at gmail dot com
New email:
PHP Version: OS:


 [2008-02-01 01:52 UTC] diemuzi at gmail dot com
Using these two functions strstr() and stristr().

The bug occurs only while using "true" when cutting characters from a string to return the value before the cut.

Reproduce code:
$email  = '';
$domain = strstr($email, '@', true);
echo $domain;

Expected result:

Actual result:
Warning: Wrong parameter count for strstr()


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-02-01 08:23 UTC] rabbi at naglfar dot hu
Or it's will be added in the 6.0.0 version...
 [2008-02-01 08:30 UTC] rabbi at naglfar dot hu
Until then use this:
$user = substr ($email, 0, strpos ($email, "@"));
 [2008-02-01 10:26 UTC]
Documentation says on changelog section:
- 6.0.0   Added the before_needle parameter.

And the new parameter is optional, the doc shows it wrong.
I'll fix it.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 17 22:01:26 2024 UTC