From:             billmarrs at gmail dot com
Operating system: Linux
PHP version:      5.0.0
PHP Bug Type:     *General Issues
Bug description:  explode on an empty string creates non-empty array

Description:
------------
explode on an empty string creates an array with a single blank element,
instead of an empty array (with no elements).

This means that explode/implode do not yield reversible results when an
empty array is used (though, they do otherwise -- when the array is
non-empty).

This is a duplicate of #699, but I'm resubmitting since #699 was closed
with no explanation a long time ago.

Reproduce code:
---------------
$a = array();

$b = explode(":", implode(":", $a));

print "a: ";
print_r($a);

print "<p>b: ";
print_r($b);

Expected result:
----------------
a: Array ( ) 
b: Array ( ) 



Actual result:
--------------
a: Array ( ) 
b: Array ( [0] => ) 

-- 
Edit bug report at http://bugs.php.net/?id=30095&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30095&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30095&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30095&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30095&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30095&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30095&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30095&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30095&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30095&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30095&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=30095&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=30095&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30095&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30095&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30095&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30095&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30095&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30095&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30095&r=mysqlcfg

Reply via email to