php.net |  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
Votes:1
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: diemuzi at gmail dot com
New email:
PHP Version: OS:

 

 [2008-02-01 01:52 UTC] diemuzi at gmail dot com
Description:
------------
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  = 'name@example.com';
$domain = strstr($email, '@', true);
echo $domain;

Expected result:
----------------
name

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] felipe@php.net
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-2020 The PHP Group
All rights reserved.
Last updated: Sat Sep 19 20:01:33 2020 UTC