cvs: pear /Config/Config/Container wddx.php
| From: | Robert Janeczek | Date: | Tue, 21 May 2002 13:43:38 +0000 |
| Subject: | cvs: pear /Config/Config/Container wddx.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-4015@lists.php.net to get a copy of this message | ||
rashid Tue May 21 09:43:38 2002 EDT
Modified files:
/pear/Config/Config/Container wddx.php
Log:
- fixed bug in Config_Container_wddx::convertForOutput() causing missing keys in converted output
Index: pear/Config/Config/Container/wddx.php
diff -u pear/Config/Config/Container/wddx.php:1.1 pear/Config/Config/Container/wddx.php:1.2
--- pear/Config/Config/Container/wddx.php:1.1 Tue May 7 12:21:37 2002
+++ pear/Config/Config/Container/wddx.php Tue May 21 09:43:38 2002
@@ -17,7 +17,7 @@
// | Robert Janeczek <rashid@ds.pg.gda.pl> |
// +---------------------------------------------------------------------+
//
-// $Id: wddx.php,v 1.1 2002/05/07 16:21:37 rashid Exp $
+// $Id: wddx.php,v 1.2 2002/05/21 13:43:38 rashid Exp $
require_once( 'Config/Container.php' ) ;
@@ -28,7 +28,7 @@
*
* @author Robert Janeczek <rashid@ds.pg.gda.pl>
* @access public
-* @version $Id: wddx.php,v 1.1 2002/05/07 16:21:37 rashid Exp $
+* @version $Id: wddx.php,v 1.2 2002/05/21 13:43:38 rashid Exp $
* @package Config
*/
@@ -105,12 +105,13 @@
function convertFromInput($data, $level = '') {
if(!is_array($data)) $data = array();
- while(list($key, $val) = each($data)) {
- if(substr($key, 0, 1) == '/') {
+
+ foreach($data as $key => $val) {
+ if(substr($key, 0, 1) == '/') {
$children[] = $key;
$this->convertFromInput($val, $level.$key);
} else {
- $values[$key] = $val;
+ $values[$key] = $val;
}
}
@@ -138,21 +139,22 @@
function convertForOutput() {
$out = array();
-
+
if(!is_array($this->data)) $this->data = array();
+
foreach ($this->data as $path => $files) {
$path = explode('/', substr($path, 1));
$tmp =& $out;
- foreach ($path as $dir) {
- if($dir == '') continue;
+ foreach ($path as $dir) {
+ if($dir === '') continue;
if (!isset($tmp['/'.$dir])) {
$tmp['/'.$dir] = array();
}
$tmp =& $tmp['/'.$dir];
}
- while(list($key, $val) = each($files)) {
- if($key != 'children') {
+ foreach($files as $key => $val) {
+ if($key !== 'children') {
$tmp[$key] = $val;
}
}