Bug #16590 [Opn]: parseConfig phparray ignores named arrays that use numbers as name

From: Date: Thu, 10 Sep 2009 15:48:18 +0000
Subject: Bug #16590 [Opn]: parseConfig phparray ignores named arrays that use numbers as name
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-1600@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=16590&edit=1 ID: 16590 Updated by: pear@kitik1.com 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 ) ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=16590&edit=1

« previous php.pear.bugs (#1600) next »