|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #26730 [chm] bug on function.explode.html
Submitted: 2003-12-28 07:26 UTC Modified: 2004-02-22 14:41 UTC
From: tomas dot matousek at matfyz dot cz Assigned:
Status: Wont fix Package: Documentation problem
PHP Version: 5.0.0b2 (beta2) OS: windows
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: tomas dot matousek at matfyz dot cz
New email:
PHP Version: OS:


 [2003-12-28 07:26 UTC] tomas dot matousek at matfyz dot cz
The explode() function misbehaves if the limit parameter has invalid value.

Reproduce code:

Expected result:
Warning + returning FALSE

Actual result:
invalid value is treated as if it was 2 and 1 respectively


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-28 14:50 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

When number parts is <0 the value defaults to 1, when it is 
0 it simply returns the specified string. 
 [2004-01-11 05:37 UTC] tomas dot matousek at matfyz dot cz
It should be so, but it is not.
I've tested the following code:


and got the following results (in PHP 5.0.0b2 as well as in PHP 4.3.4):

array(2) {
  string(1) "a"
  string(9) "b,c,d,e,f"
array(1) {
  string(11) "a,b,c,d,e,f"
array(1) {
  string(11) "a,b,c,d,e,f"

IMHO there is a bug in the case the value is < -1.

Moreover, there is no specification in manual of what the function should
return if the value <= 0 (i.e. that -1 means infinity and values <-1 mean

Tomas Matousek
 [2004-01-29 12:23 UTC] tomas dot matousek at matfyz dot cz
Not a "bogus".
 [2004-02-22 14:41 UTC]
I think there's nothing to do here.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Feb 22 12:01:29 2024 UTC