Bug #62461 [Opn->Nab]: error in explode
| From: | aharvey@php.net | Date: | Mon, 02 Jul 2012 03:01:16 +0000 |
| Subject: | Bug #62461 [Opn->Nab]: error in explode | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-171663@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62461&edit=1
ID: 62461
Updated by: aharvey@php.net
Reported by: php dot net at pravec dot de
Summary: error in explode
-Status: Open
+Status: Not a bug
Type: Bug
Package: Strings related
Operating System: debian
PHP Version: 5.3.14
Block user comment: N
Private report: N
New Comment:
Quoting the manual:
"If delimiter contains a value that is not contained in string and a negative
limit is used, then an empty array will be returned, otherwise an array
containing string will be returned."
This is the second case: the delimiter isn't in the string, so an array
containing the string is returned.
Not a bug -> closing.
Previous Comments:
------------------------------------------------------------------------
[2012-07-02 02:16:19] php dot net at pravec dot de
Description:
------------
---
From manual page: http://www.php.net/function.explode#refsect1-function.explode-description
---
Test script:
---------------
$a = explode("\r\n", "");
$b = fixed_explode("\r\n", "");
printf("(%d/%d)", count($a), count($b));
function fixed_explode($delimiter, $string, $limit = 0xFFFFFFFF)
{
return($string ? explode($delimiter, $string, $limit) : array());
}
Expected result:
----------------
result will be (1/0) but should be (0/0)
it's on you to fix this. i guess this must be an error.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62461&edit=1