FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=16590&edit=1

ID: 16590
Updated by: cweiske@php.net
Reported By: pear at kitik1 dot com
Summary: parseConfig phparray ignores named arrays that use
numbers as name
-Status: Open
+Status: Closed
Type: Bug
Package: Config
Operating System: Ubuntu 9.04
Package Version: 1.10.11
PHP Version: 5.2.5
-Assigned To:
+Assigned To: cweiske
Roadmap Versions:
New Comment:

-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: cweiske
This is a bug, yes. I fixed it in SVN and the next release will contain
the fix.


Previous Comments:
------------------------------------------------------------------------

[2009-09-10 16:48:18] circalucid

Dote~! Sorry, switch the expected and actual results. I accidentally
tossed those in backwards.

------------------------------------------------------------------------

[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
)

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedDec 20, '10 at 8:46a
activeDec 20, '10 at 8:46a
posts1
users1
websitepear.php.net

1 user in discussion

Cweiske: 1 post

People

Translate

site design / logo © 2022 Grokbase