GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (4873)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/common/TreeNode/TreeNode.class.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Copyright (c) STMicroelectronics, 2005. All Rights Reserved.
4
 *
5
 * Originally written by Manuel Vacelet, 2005
6
 *
7
 * This file is a part of Codendi.
8
 *
9
 * Codendi is free software; you can redistribute it and/or modify
10
 * it under the terms of the GNU General Public License as published by
11
 * the Free Software Foundation; either version 2 of the License, or
12
 * (at your option) any later version.
13
 *
14
 * Codendi is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with Codendi. If not, see <http://www.gnu.org/licenses/>.
21
 */
22
23
/**
24
 * TreeNode class handle one Node in a Tree representation.
25
 *
26
 * A Tree is a composition of Node. A Node can have children or Not.
27
 * A Node without Children can be considered as a Leaf.
28
 * This class do not propose default method to walk through. You can use an
29
 * iterator to iterate on Childs or a Visitor to walk through the hierarchy.
30
 *
31
 * @author: Manuel Vacelet <[email protected]>
32
 * @see: Visitor
33
 */
34
class TreeNode /*implements Visitable*/ {
35
    /**
36
     * @type mixed
37
     */
38
    var $data;
39
    
40
    /**
41
     * @var mixed
42
     */
43
    var $object;
44
45
    /**
46
     * @type array
47
     */
48
    var $children;
49
    
50
    /**
51
     * @type TreeNode Reference
52
     */
53
    var $parentNode;
54
    
55
    private $id;
56
    
57
    
58
    /**
59
     * Constructor
60
     */
61
    function TreeNode($data=null, $id=null) {
62
        $this->id = ($id === null) ? uniqid() : $id;
63
        /*if(func_num_args() !== 0) {
64
            trigger_error(get_class($this).'::TreeNode => Do not accept arguments', E_USER_ERROR);
65
        }*/
66
        $this->data       = $data;
67
        $this->children   = array();
68
        $this->parentNode = null;
69
    }
70
    
71
    public function getId() {
72
        return $this->id;
73
    }
74
    
75
    public function setId($id) {
76
        $this->id = $id;
77
    }
78
79
    /**
80
     * Set data for current node.
81
     *
82
     * @param mixed $d Any kind of data stored in a Node
83
     */
84
    function setData($d) {
85
        $this->data = $d;
86
    }
87
88
89
    /**
90
     * Return a reference on data of current node.
91
     * 
92
     * @return mixed (reference)
93
     */
94
    function &getData() {
95
        return $this->data;
96
    }
97
    
98
99
    /**
100
     * Set current node parent.
101
     * 
102
     * @access private
103
     * @return mixed (reference)
104
     */
105
    function _setParentNode(&$node) {
106
        if(is_object($node) && is_a($node, 'TreeNode') ) {
107
            $this->parentNode =& $node;
108
        }
109
        else {
110
            trigger_error(get_class($this).'::setParentNode => require: TreeNode given: "'.  get_class($node).'"', E_USER_ERROR);
111
        }
112
    }
113
114
115
    /**
116
     * Return a reference on current node parent.
117
     * 
118
     * @return mixed (reference)
119
     */
120
    function &getParentNode() {
121
        return $this->parentNode;
122
    }
123
124
125
    /**
126
     * Add a new TreeNode as next child.
127
     *
128
     * @param TreeNode &$c A TreeNode (reference call)
129
     */
130
    function addChild($c) {
131
        if(is_object($c) && is_a($c, 'TreeNode')) {
132
            if($this->children === null) {
133
                $this->children = array();
134
            }
135
            $c->_setParentNode($this);
136
            $this->children[] = $c;
137
        }
138
        else {
139
            trigger_error(get_class($this).'::addChild => require: TreeNode given: "'.get_class($c).'"', E_USER_ERROR);
140
        }
141
    }
142
143
    /**
144
     * Allows to define a tree inline (usefull for tests)
145
     *
146
     * @return TreeNode
147
     */
148
    function addChildren() {
149
        $child_list = func_get_args();
150
        foreach ($child_list as $child) {
151
            $this->addChild($child);
152
        }
153
        return $this;
154
    }
155
156
    /**
157
     * Remove a child.
158
     * 
159
     * @param int $key Id of child to remove.
160
     */
161
    function removeChild($key, $object = null) {
162
        if (!$key && $object && is_array($this->children)) {
163
            $key = array_search($object, $this->children);
164
        }
165
        if(isset($key) && is_int($key) && is_array($this->children) && array_key_exists($key, $this->children)) {
166
            unset($this->children[$key]);
167
            $this->children = array_values($this->children);
168
        }
169
        else {
170
            trigger_error(get_class($this).'::removeChild => require: "int" given: "'.gettype($key).'"', E_USER_ERROR);
171
        }
172
    }
173
174
175
    /**
176
     * Return reference on asked child.
177
     *
178
     * @param int $key Id of child to return
179
     * @return TreeNode reference.
180
     */
181
    function &getChild($key) {
182
        if(isset($key) && is_int($key) && is_array($this->children) && array_key_exists($key, $this->children)) {
183
            return $this->children[$key];
184
        }
185
        else {
186
            trigger_error(get_class($this).'::getChild => require: "int" given: "'.gettype($key).'"', E_USER_ERROR);
187
        }
188
    }      
189
190
191
    /**
192
     * Get children 
193
     *
194
     * @return array of TreeNode
195
     */
196
    function &getChildren() {
197
        return $this->children;
198
    }
199
200
201
    /**
202
     * Set children. 
203
     *
204
     * @param $children array of TreeNode
205
     */
206
    function setChildren($children) {
207
        if(is_array($this->children)) {
208
            $this->clearChildren();
209
            foreach ($children as $child) {
210
                $this->addChild($child);
211
            }
212
        }
213
        else {
214
            trigger_error(get_class($this).'::setChildren => require: "array" given: "'.gettype($children).'"', E_USER_ERROR);
215
        }
216
    }
217
218
    /**
219
     * Remove existing children
220
     */
221
    public function clearChildren() {
222
        $this->children = array();
223
    }
224
225
    /**
226
     * Return true if Node has children. 
227
     *
228
     * @return boolean.
0 ignored issues
show
The doc-type boolean. could not be parsed: Unknown type name "boolean." at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
229
     */
230
    function hasChildren() {
231
        return (count($this->children) > 0);
232
    }
233
234
    /**
235
     * @return bool
236
     */
237
    private function hasChild(TreeNode $child) {
238
        return in_array($child, $this->children);
239
    }
240
241
    /**
242
     * Add the child only if the current node doesn't already contain it
243
     */
244
    public function addSingularChild(TreeNode $child) {
245
        if (!$this->hasChild($child)) {
246
            $this->addChild($child);
247
        }
248
    }
249
250
    /**
251
     * Visitor entry. 
252
     *
253
     * @param Visitor
254
     */
255
    function accept(&$visitor, $params = null) {
256
        return $visitor->visit($this, $params);
257
    }
258
    
259
    public function __toString() {
260
        $children_as_string = '';
261
        foreach ($this->getChildren() as $child) {
262
            $children_as_string .= $child->__toString() .",\n";
263
        }
264
        return 'TreeNode #'. $this->id ." {\n $children_as_string }\n";
265
    }
266
267
    /**
268
     * @return array A flat list of all descendant nodes (usefull for tests).
269
     */
270
    public function flattenChildren() {
271
        $flatten_children = array();
272
        
273
        foreach($this->getChildren() as $child) {
274
            $flatten_children = array_merge($flatten_children, $child->flatten());
275
        }
276
        
277
        return $flatten_children;
278
    }
279
    
280
    /**
281
     * @return array A flat list of this node and all its descendants (usefull for tests).
282
     */
283
    public function flatten() {
284
        return array_merge(array($this), $this->flattenChildren());
285
    }
286
    
287
    public function getObject() {
288
        return $this->object;
289
    }
290
    
291
    public function setObject($object) {
292
        $this->object = $object;
293
    }
294
}
295
296
?>