MantisBT

View Issue Details Jump to Notes ] Wiki ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012336mantisbtgraphspublic2010-09-10 05:182013-04-06 09:26
Reportergthomas 
Assigned Todhx 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Versiongit trunk 
Target Version1.3.xFixed in Version1.3.x 
Summary0012336: Syntax error in graphviz_api.php on line 435
DescriptionSeems to be an indentation-implied plus closing brace error.
Additional InformationPatch attached.
Tags2.0.x check, patch
Attached Filespatch file icon graphviz_syntax_error.patch [^] (2,050 bytes) 2010-09-10 05:18 [Show Content]

- Relationships
related to 0015721new Functionality to consider porting to master-2.0.x 

-  Notes
User avatar (0026899)
Renegade (reporter)
2010-09-28 21:28

The product version for this issue is set to "git trunk". I am personally running 1.2.3 from the site. Should the file have significantly changed between the 1.2.x branch and the current trunk, ignore me.

Otherwise:

I applied this patch because I couldn't get graphviz to run with Mantis, despite the fact that it works fine when called manually.

I am now getting an error
PHP Parse error: syntax error, unexpected T_CLASS, expecting T_FUNCTION in [path]/core/graphviz_api.php on line 498
when trying to call a graph.
line 498 contains a single curly brace in my patched version.

Normal diff shows a bunch of tab changes, diff -w shows exactly one change:
425a426
> }
since that matches the description in the issue, I'm rather sure the patch applied smoothly.

Long story short: As far as I can tell, the original version was alright (didn't throw an error), and the patched version causes an error.

As said, if this doesn't apply because trunk and 1.2.x differ in that file, ignore me. Just thought I'd make note of it, especially since others might get the same idea.
User avatar (0026900)
gthomas (reporter)
2010-09-29 01:34

1.2.x is totally different from git-trunk:
It has special case handling for windows servers (WinGraph), and had a syntax error (missing }) which is corrected by this patch.

index 44d43e8..b10aed1
--- a/core/graphviz_api.php
+++ b/core/graphviz_api.php
@@ -1,5 +1,5 @@
 <?php
-# MantisBT - a php based bugtracking system
+# MantisBT - A PHP based bugtracking system
 
 # MantisBT is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -15,25 +15,31 @@
 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>. [^]
 
 /**
+ * GraphViz API
+ *
  * Wrapper classes around GraphViz utilities (dot and neato) for
- * directed and undirected graph generation. Under Windows, the COM
- * API provided by WinGraphviz is used. These wrappers are enhanced
+ * directed and undirected graph generation. These wrappers are enhanced
  * enough just to support relationship_graph_api.php. They don't
  * support subgraphs yet.
  *
  * The original Graphviz package is available at:
- * - http://www.research.att.com/sw/tools/graphviz/ [^]
- * WinGraphviz can be installed from:
- * - http://home.so-net.net.tw/oodtsen/wingraphviz/ [^]
+ * - http://www.graphviz.org/ [^]
  * Additional documentation can be found at:
  * - http://www.graphviz.org/Documentation.html [^]
+ *
  * @package CoreAPI
  * @subpackage GraphVizAPI
  * @author Juliano Ravasi Ferraz <jferraz at users sourceforge net>
  * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sou
  * @link http://www.mantisbt.org [^]
+ *
+ * @uses constant_inc.php
+ * @uses utility_api.php
  */
 
+require_api( 'constant_inc.php' );
+require_api( 'utility_api.php' );
+
 /**
  * constant(s) defining the output formats supported by dot and neato.
  */
@@ -317,82 +323,19 @@ class Graph {
                if( $p_headers ) {
                        header( 'Content-Type: ' . $t_mime );
                }
-
                # Retrieve the source dot document into a buffer
                ob_start();
                $this->generate();
                $t_dot_source = ob_get_contents();
                ob_end_clean();
 
- # There are three different ways to generate the output dependin
- # on the operating system and PHP version.
- if( is_windows_server() ) {
- # If we are under Windows, we use the COM interface prov
- # by WinGraphviz. Thanks Paul!
- # Issue 0004625: Work around WinGraphviz bug that fails wi
- # graphs with zero or one node. It is probably too much
- # generate a graphic output just to explain it to the us
- # so we just return a null content.
- if( count( $this->nodes ) <= 1 ) {
- return;
- }
-
- $t_graphviz = new COM( $this->graphviz_com_module );
-
- # Check if we managed to instantiate the COM object.
- if( is_null( $t_graphviz ) ) {
- # We can't display any message or trigger an err
- # failure, since we may have already sent a Cont
- # header potentially incompatible with the any h
- return;
- }
-
- if( $t_binary ) {
- # Image formats
- $t_dot_output = $t_graphviz->ToBinaryGraph( $t_d
-
- if( $p_headers ) {
- # Headers were requested, use another ou
- # to retrieve the size for Content-Lengt
- ob_start();
- echo base64_decode( $t_dot_output->ToBas
- header( 'Content-Length: ' . ob_get_leng
- ob_end_flush();
- } else {
- # No need for headers, send output direc
- echo base64_decode( $ret->ToBase64String
- }
- } else {
- # Text formats
- $t_dot_output = $t_graphviz->ToTextGraph( $t_dot
-
- if( $p_headers ) {
- header( 'Content-Length: ' . utf8_strlen
- }
-
- echo $t_dot_output;
- }
-
- unset( $t_graphviz );
- } else {
- # If we are not under Windows, use proc_open,
- # since it avoids the need of temporary files.
                        # Start dot process
+
                        $t_command = $this->graphviz_tool . ' -T' . $p_format;
                        $t_descriptors = array(
- 0 => array(
- 'pipe',
- 'r',
- ),
- 1 => array(
- 'pipe',
- 'w',
- ),
- 2 => array(
- 'file',
- 'php://stderr', [^]
- 'w',
- ),
+ 0 => array( 'pipe', 'r', ),
+ 1 => array( 'pipe', 'w', ),
+ 2 => array( 'file', 'php://stderr', [^] 'w', ),
                        );
 
                        $t_pipes = array();
@@ -423,7 +366,6 @@ class Graph {
                                proc_close( $t_proccess );
                        }
                }
- }
 
        /**
         * PROTECTED function to build a node or edge attribute list.
User avatar (0026901)
Renegade (reporter)
2010-09-29 02:56

Well as said...at least others running 1.2.x won't get the same idea now.

A clearer version marking than "trunk" would help avoid such confusion, btw.
The trunk version this was submitted for 19 days ago could be totally different than the current trunk version as well, despite both being the "trunk" version.
User avatar (0027127)
dhx (developer)
2010-10-22 07:50

Thanks for the patch Gulacsi, I have finally committed it. Apologies for the delayed commit.

This problem only affected version 1.3.x of MantisBT (not 1.2.x).
User avatar (0036477)
grangeway (developer)
2013-04-05 17:57

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch

- Related Changesets
MantisBT: master 0ed24722
Timestamp: 2010-09-10 08:58:20
Author: Gulacsi Tamas
Committer: dhx
Details ] Diff ]
fix graphiz_api indentation and syntax error

Signed-off-by: David Hicks <hickseydr@optusnet.com.au>

- Issue History
Date Modified Username Field Change
2010-09-10 05:18 gthomas New Issue
2010-09-10 05:18 gthomas File Added: graphviz_syntax_error.patch
2010-09-10 09:49 dhx Tag Attached: patch
2010-09-10 09:50 dhx Status new => acknowledged
2010-09-10 09:50 dhx Target Version => 1.3.x
2010-09-28 21:28 Renegade Note Added: 0026899
2010-09-29 01:34 gthomas Note Added: 0026900
2010-09-29 02:56 Renegade Note Added: 0026901
2010-10-22 07:49 dhx Assigned To => dhx
2010-10-22 07:49 dhx Status acknowledged => assigned
2010-10-22 07:50 dhx Note Added: 0027127
2010-10-22 07:50 dhx Status assigned => resolved
2010-10-22 07:50 dhx Fixed in Version => 1.3.x
2010-10-22 07:50 dhx Resolution open => fixed
2010-10-22 08:33 dhx Changeset attached => MantisBT master 0ed24722
2013-04-05 17:57 grangeway Status resolved => acknowledged
2013-04-05 17:57 grangeway Note Added: 0036477
2013-04-05 18:07 grangeway Relationship added related to 0015721
2013-04-06 03:44 dregad Status acknowledged => resolved
2013-04-06 07:20 grangeway Status resolved => acknowledged
2013-04-06 09:26 dregad Tag Attached: 2.0.x check
2013-04-06 09:26 dregad Status acknowledged => resolved


MantisBT 1.2.16dev master-1.2.x-8c2bd07 [^]
Copyright © 2000 - 2013 MantisBT Team
Time: 0.1307 seconds.
memory usage: 2,849 KB
Powered by Mantis Bugtracker