Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.10.12

Bug #16590 parseConfig phparray ignores named arrays that use numbers as name
Submitted: 2009-09-10 20:42 UTC
From: circalucid Assigned: cweiske
Status: Closed Package: Config (version 1.10.11)
PHP Version: 5.2.5 OS: Ubuntu 9.04
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 34 - 15 = ?

 
 [2009-09-10 20:42 UTC] circalucid (Bobbie Stivers)
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 )

Comments

 [2009-09-10 20:48 UTC] circalucid (Bobbie Stivers)
Dote~! Sorry, switch the expected and actual results. I accidentally tossed those in backwards.
 [2010-12-20 14:47 UTC] cweiske (Christian Weiske)
-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.