Re: Bug #18676 [Com]: Cluster doesn't show if there's no nodes inside.

From: Date: Sat, 25 Feb 2012 15:32:33 +0000
Subject: Re: Bug #18676 [Com]: Cluster doesn't show if there's no nodes inside.
References: 1  Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-6033@lists.php.net to get a copy of this message
Mobile@root On 2012年2月10日, at 下午12:48, "fgmarand@gmail.com" <pear-qa@lists.php.net> wrote: > Edit report at > https://pear.php.net/bugs/bug.php?id=18676&edit=1 > > ID: 18676 > Comment by: fgmarand@gmail.com > Reported By: redvex at me dot com > Summary: Cluster doesn't show if there's no nodes inside. > Status: Open > Type: Bug > Package: Image_GraphViz > Operating System: Debian 4.0 > Package Version: 1.3.0 > PHP Version: 5.2.0 > Roadmap Versions: > New Comment: > > I just rolled this proposition as a patch against 1.3.0. It does not fix > the bug for me, though. Try this: > > <?php > include 'Image/GraphViz.php'; > $g = new Image_Graphviz(); > $g->addcluster('c1', 'c1', array('label' => 'A > cluster!')); > $g->image(); > > The warning is gone, but the graph is still empty and unlabeled, while > this works normally, displaying both node and cluster label. > > <?php > include 'Image/GraphViz.php'; > $g = new Image_Graphviz(); > $g->addcluster('c1', 'c1', array('label' => 'A > cluster!')); > $g->addNode('n', array(), 'c1'); > $g->image(); > > > Previous Comments: > ------------------------------------------------------------------------ > > [2012-02-10 16:45:34] fgm > > Added #patch > bug:18676;patch:clsuter_no_nodes-18676;revision:1328892334;. > > ------------------------------------------------------------------------ > > [2011-07-30 11:43:43] doconnor > > -Type: Feature/Change Request > +Type: Bug > Thanks Gianni; but could I get you to do this as a patch against svn? > It'll be a lot > easier to see the differences. > > Additionally; any chance of a test case to prove your changed > implementation > works/doesn't work? > > ------------------------------------------------------------------------ > > [2011-07-21 10:14:20] redvex > > Description: > ------------ > Cluster doesn't show if there's no node inside even if it has > other cluster or subgraph inside. To solve it I've changed > > function _nodes($nodes, $indent){ > $parsedGraph = ''; > foreach ($nodes as $node => $attributes) { > $parsedGraph .= $indent.$this->_escape($node); > > $attributeList = array(); > > foreach ($this->_escapeArray($attributes) as $key => > $value) { > $attributeList[] = $key.'='.$value; > } > > if (!empty($attributeList)) { > $parsedGraph .= ' [ '.implode(',', $attributeList).' > ]'; > } > > $parsedGraph .= ";\n"; > } > return $parsedGraph; > } > > to > > function _nodes($nodes, $indent){ > $parsedGraph = ''; > if (is_array($nodes)){ > foreach ($nodes as $node => $attributes) { > $parsedGraph .= $indent.$this- >> _escape($node); > > $attributeList = array(); > > foreach ($this->_escapeArray($attributes) as > $key => $value) { > $attributeList[] = $key.'='.$value; > } > > if (!empty($attributeList)) { > $parsedGraph .= ' [ '.implode(',', > $attributeList).' ]'; > } > > $parsedGraph .= ";\n"; > } > } > return $parsedGraph; > } > > ------------------------------------------------------------------------ > > > -- > Edit this bug report at > https://pear.php.net/bugs/bug.php?id=18676&edit=1 > > > -- > PEAR Bugs Mailing List (http://pear.php.net/bugs/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.pear.qa (#6033) next »