cvs: pear /Tree/Memory Array.php

From: Date: Sat, 18 Jan 2003 15:36:22 +0000
Subject: cvs: pear /Tree/Memory Array.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-8375@lists.php.net to get a copy of this message
cain Sat Jan 18 10:36:22 2003 EDT Modified files: /pear/Tree/Memory Array.php Log: - prevent some E_ALL warnings Index: pear/Tree/Memory/Array.php diff -u pear/Tree/Memory/Array.php:1.4 pear/Tree/Memory/Array.php:1.5 --- pear/Tree/Memory/Array.php:1.4 Sat Jan 4 06:56:28 2003 +++ pear/Tree/Memory/Array.php Sat Jan 18 10:36:22 2003 @@ -16,7 +16,7 @@ // | Authors: Wolfram Kriesing <wolfram@kriesing.de> | // +----------------------------------------------------------------------+ // -// $Id: Array.php,v 1.4 2003/01/04 11:56:28 mj Exp $ +// $Id: Array.php,v 1.5 2003/01/18 15:36:22 cain Exp $ require_once('Tree/Error.php'); @@ -85,15 +85,14 @@ foreach( $array as $nodeKey=>$aNode ) { $newData = $aNode; - if( !$newData['id'] ) - { + if ( !isset($newData['id']) || !$newData['id'] ) { $newData['id'] = $this->_id++; $array[$nodeKey]['id'] = $newData['id']; } $newData['parentId'] = $parentId; $children = null; - foreach( $newData as $key=>$val ) // remove the 'children' array, since this is only info for this class + foreach ( $newData as $key=>$val ) // remove the 'children' array, since this is only info for this class { if( $key=='children' ) { @@ -102,8 +101,12 @@ } $this->data[] = $newData; - if( $aNode['children'] ) + if ( isset($aNode['children']) && $aNode['children'] ) { + if( !isset($array[$nodeKey]['children']) ) { + $array[$nodeKey]['children'] = array(); + } $this->_setup( $array[$nodeKey]['children'] , $newData['id'] ); + } } } @@ -192,4 +195,4 @@ } } // end of class -?> \ No newline at end of file +?>

« previous php.pear.cvs (#8375) next »