Edit report at http://pear.php.net/bugs/bug.php?id=16590&edit=1
ID: 16590
Updated by: [email protected]
Reported By: pear at kitik1 dot com
Summary: parseConfig phparray ignores named arrays that use
numbers as name
Status: Open
Type: Bug
Package: Config
Operating System: Ubuntu 9.04
Package Version: 1.10.11
PHP Version: 5.2.5
Roadmap Versions:
New Comment:
Dote~! Sorry, switch the expected and actual results. I accidentally
tossed those in backwards.
Previous Comments:
------------------------------------------------------------------------
[2009-09-10 16:42:09] circalucid
Description:
------------
I'm not entirely sure this is a bug or an intended behavior in PHP but
when I create an array and assign a number as the first element's name,
I get a sequential array after passing this array to parseConfig. If the
first element is a string, everything works kosher whether any of the
following names are a string or number.
I'm using a workaround prefix but is this a bug?
Test script:
---------------
<?php
include("Config.php");
$conf2 = array(
'DB' => array(
'203' => 'mysql',
'host' => 'localhost',
'user' => 'root',
'pass' => 'root'
)
);
$conf2 = array('root' => $conf2);
print_r($conf2['root']['DB']);
$c = new Config();
$arr_read =& $c->parseConfig($conf2['root'],'phparray');
$arr_read = $arr_read->toArray();
if (PEAR::isError($arr_read)){die('Dote'."\n");}
print_r($arr_read['root']['DB']);
unset($arr_read);
?>
Expected result:
----------------
Array
(
[203] => mysql
[host] => localhost
[user] => root
[pass] => root
)
Array
(
[0] => mysql
[1] => localhost
[2] => root
[3] => root
)
Actual result:
--------------
Array
(
[203] => mysql
[host] => localhost
[user] => root
[pass] => root
)
Array
(
[203] => mysql
[host] => localhost
[user] => root
[pass] => root
)
------------------------------------------------------------------------