php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42834 strstr before_needle bug
Submitted: 2007-10-03 04:31 UTC Modified: 2007-10-03 08:12 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: calvink at conceptualnetworking dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.4 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: calvink at conceptualnetworking dot com
New email:
PHP Version: OS:

 

 [2007-10-03 04:31 UTC] calvink at conceptualnetworking dot com
Description:
------------
strstr() does not handle the third parameter appropriately for before_needle.

This uses the example provided in the documentation for strstr.

Reproduce code:
---------------
$email  = 'name@example.com';
$user = strstr($email, '@', true);
echo $user;

Expected result:
----------------
It should print "name"

Actual result:
--------------
Nothing is displayed and I receive the error:

Warning: Wrong parameter count for strstr() in /xxx/xxx/x/test_read.php5

This also occured using PHP 4.4.7.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-03 05:11 UTC] judas dot iscariote at gmail dot com
6.0.0	 Added the before_needle parameter

so, the error is expected , parameter only present in PHP6 (CVS HEAD atm)
 [2007-10-03 08:12 UTC] tony2001@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 [2010-11-20 23:42 UTC] michael dot t dot bryan at gmail dot com
This was added in php 5.3.0 according the manual as of this date. I am running php 
5.3.3 and encounter this error.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 09:01:31 2025 UTC