Issues (9)

Security Analysis    no request data  

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.

webroot/specified-table.php (3 issues)

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
 * Tests to generate specified HTML table from from a array of objects and
4
 * specification arrays.
5
 *
6
 * Generates an HTML table fron an array of objects, where each object contains
7
 * a number of data, according to the specifications in the table- and the
8
 * column specification array.
9
 *
10
 * In the table specification it is possible to set the CSS id and/or class for
11
 * the table and the table caption.
12
 *
13
 * In the column specification the arrays order corresponds to the columns order
14
 * in the table. The name of the key in the column specifiation should
15
 * correspond to the key in the object, where the data should be fetched from.
16
 *
17
 * It is possible to specify a title of the column in the column specification.
18
 * If no title is specified, the key name in the object of the first row is used.
19
 * The same name as the key in the column specification.
20
 *
21
 * It is possible to define a function for the column. The function could be
22
 * used to use an algorithm for the table data in the object or add a string
23
 * of HTML tags for the column. It is also possible to fetch the whole object
24
 * by naming the key in the column specifiation so it starts with object...
25
 * This makes it possible to use all the data in the object if it is wanted.
26
 *
27
 * The type could be set to footer and colspan could also be used, if wanted.
28
 *
29
 * @author Gunnar Eriksson <[email protected]>
30
 */
31
include('../autoloader.php');
32
33
// Create data objects.
34
$row0 = new stdClass();
35
$row0->column1 = "Table Cell 1";
36
$row0->column2 = "Table Cell 2";
37
$row0->column3 = "Table Cell 3";
38
$row0->column4 = "https://www.google.se";
39
$row0->column5 = "Table Cell 5";
40
$row0->column6 = "Table Cell 6";
41
42
$row1 = new stdClass();
43
$row1->column1 = "Table Cell 7";
44
$row1->column2 = "Table Cell 8";
45
$row1->column3 = "Table Cell 9";
46
$row1->column4 = "https://www.google.se";
47
$row1->column5 = "Table Cell 11";
48
$row1->column6 = "";
49
50
$row2 = new stdClass();
51
$row2->column1 = "Table Cell 13";
52
$row2->column2 = "Table Cell 14";
53
$row2->column3 = "Table Cell 15";
54
$row2->column4 = "https://www.google.se";
55
$row2->column5 = "Table Cell 17";
56
$row2->column6 = "Table Cell 18";
57
58
// Create table data, which is an array of data objects.
59
$data = [
60
	0 => $row0,
61
	1 => $row1,
62
	2 => $row2,
63
];
64
65
// Create table specifiation.
66
$tableSpecification = [
67
	//'id'        => 'test-table',
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
68
	//'class'	=> 'test-table',
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
69
	'caption'	=> 'The table'
70
];
71
72
// Create table with table specification, table data and the column specification.
73
$table = new \Guer\HTMLTable\CHTMLTable();
74
$table = $table->create($tableSpecification, $data, [
75
	'column1' => [
76
        'title' => 'Table Header 1',
77
    ],
78
	'object1' => [
79
		'title'     => 'Table Header 2',
80
		'function'	=> function($object) {
81
			return htmlentities($object->column2, null, 'UTF-8');
82
		}
83
    ],
84
    'column4' => [
85
        'title'     => 'Table Header 4',
86 View Code Duplication
		'function'	=> function($link) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
87
			return '<a href="'. htmlentities($link, null, 'UTF-8') . '">' . "Google" . '</a>';
88
		}
89
    ],
90
	'column6' => [
91
        'title'    	=> 'Table Header 6',
92
		'function' 	=> function($tableCell6) {
93
        	return empty($tableCell6) ? 'Not present' :  'Present';
94
   		}
95
    ],
96
	'tablefoot1' => [
97
        'type'      => 'footer',
98
		'colspan'  	=> '2',
99
		'value'		=> 'Footer Cell 1',
100
    ],
101
	'tablefoot2' => [
102
        'type'      => 'footer',
103
		'colspan'  	=> 2,
104
		'function'	=> function() {
105
        	return '<a href="https://www.google.se">Link</a>';
106
   		}
107
    ],
108
]);
109
110
?>
111
112
<!doctype html>
113
<meta charset=utf8>
114
<title>Example on using specified HTML table with CHTMLTable</title>
115
<link rel="stylesheet" type="text/css" href="css/html-table.css" />
116
<!-- Echo out the form -->
117
<h1>Example on using specified HTML table with CHTMLTable</h1>
118
<?=$table->getHTMLTable()?>
119