Re: [PEAR-BUGS] [PEAR-BUG] Bug #18676 [Com]: Cluster doesn't show if there's no nodes inside.
[email protected] (lin Jim) Sat, 25 Feb 2012 11:32:33 -0400
| Newsgroups | php.pear.qa |
|---|---|
| Message-ID | <[email protected]> |
Mobile@root On 2012年2月10日, at 下午12:48, "[email protected]" <[email protected]> wrote: > Edit report at https://pear.php.net/bugs/bug.php?id=18676&edit=1 > > ID: 18676 > Comment by: [email protected] > 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 >