Bug #62461 [Nab]: error in explode
Edit report at https://bugs.php.net/bug.php?id=62461edit=1 ID: 62461 User updated by:php dot net at pravec dot de Reported by:php dot net at pravec dot de Summary:error in explode 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: as i can see, javascript works like php. so asp/vbs is a special case. strange so i have to do it different way (translating from asp to php) Previous Comments: [2012-07-07 22:59:23] ras...@php.net Why should an empty string be treated differently from a non-empty string here? explode() is defined to return an array of strings each of which is a substring of string formed by splitting it on boundaries formed by the string delimiter. So you have string abc or you have string and you try to split it by x. abc split up by the delimiter x is just going to give you abc just like split by delimiter x is just going to give you [2012-07-07 22:46:05] php dot net at pravec dot de i know ... php is not vbscript. but take this a = For Each b in Split(a, :) Call MsgBox(b) Next a can contain 1, 1:2, or if a is 1 a single popup will appear if a is 1:2 two popup will appear if a is no popup will appear if string is empty, counting explode have to return 0, not 1 nothing divided by something will return: nothing ... not 1 [2012-07-02 03:01:16] ahar...@php.net 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. [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 = 0x) { 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=62461edit=1
Bug #62461 [Nab]: error in explode
Edit report at https://bugs.php.net/bug.php?id=62461edit=1 ID: 62461 User updated by:php dot net at pravec dot de Reported by:php dot net at pravec dot de Summary:error in explode 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: i know ... php is not vbscript. but take this a = For Each b in Split(a, :) Call MsgBox(b) Next a can contain 1, 1:2, or if a is 1 a single popup will appear if a is 1:2 two popup will appear if a is no popup will appear if string is empty, counting explode have to return 0, not 1 nothing divided by something will return: nothing ... not 1 Previous Comments: [2012-07-02 03:01:16] ahar...@php.net 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. [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 = 0x) { 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=62461edit=1
[PHP-BUG] Bug #62461 [NEW]: error in explode
From: php dot net at pravec dot de Operating system: debian PHP version: 5.3.14 Package: Strings related Bug Type: Bug Bug description:error in explode 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 = 0x) { 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 bug report at https://bugs.php.net/bug.php?id=62461edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62461r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62461r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62461r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=62461r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62461r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=62461r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=62461r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=62461r=needscript Try newer version: https://bugs.php.net/fix.php?id=62461r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=62461r=support Expected behavior: https://bugs.php.net/fix.php?id=62461r=notwrong Not enough info: https://bugs.php.net/fix.php?id=62461r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=62461r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=62461r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62461r=php4 Daylight Savings:https://bugs.php.net/fix.php?id=62461r=dst IIS Stability: https://bugs.php.net/fix.php?id=62461r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=62461r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=62461r=float No Zend Extensions: https://bugs.php.net/fix.php?id=62461r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=62461r=mysqlcfg