Issues (85)

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/Table.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
 * @package    Fuel\Common
4
 * @version    2.0
5
 * @author     Fuel Development Team
6
 * @license    MIT License
7
 * @copyright  2010 - 2015 Fuel Development Team
8
 * @link       http://fuelphp.com
9
 */
10
11
namespace Fuel\Common;
12
13
use Fuel\Common\Table\Row;
14
use Fuel\Common\Table\Cell;
15
use Fuel\Common\Table\EnumRowType;
16
17
/**
18
 * Deals with constructing table structures.
19
 *
20
 * @package Fuel\Common
21
 *
22
 * @since 2.0
23
 */
24
class Table
25
{
26
	/**
27
	 * @var array
28
	 */
29
	protected $rows = [];
30
31
	/**
32
	 * @var array
33
	 */
34
	protected $headerRows = [];
35
36
	/**
37
	 * @var array
38
	 */
39
	protected $footerRows = [];
40
41
	/**
42
	 * @var Row The row that new cells will be added to
43
	 */
44
	protected $currentRow = null;
45
46
	/**
47
	 * @var array
48
	 */
49
	protected $attributes = [];
50
51
	/**
52
	 * Adds a Cell to the current Row
53
	 *
54
	 * @param mixed $content    Anything that is not a Cell will be added as content to a new Cell
55
	 * @param array $attributes The array of attributes to assign the new Cell
56
	 *
57
	 * @return $this
58
	 */
59
	public function addCell($content, $attributes = array())
60
	{
61
		$currentRow = $this->getCurrentRow();
62
		//If we have been given a Cell then just add it, else create a new cell
63
		if ( $content instanceof Cell )
64
		{
65
			$currentRow[] = $content;
66
		}
67
		else
68
		{
69
			$currentRow[] = $this->constructCell($content, $attributes);
70
		}
71
72
		return $this;
73
	}
74
75
	/**
76
	 * Creates a new Cell with the given content
77
	 *
78
	 * @param mixed $content    The content for the new Cell
79
	 * @param array $attributes The attributes for the Cell
80
	 *
81
	 * @return Cell
82
	 */
83
	protected function constructCell($content = null, $attributes = array())
84
	{
85
		$cell = new Cell($content);
86
		$cell->setAttributes($attributes);
87
88
		return $cell;
89
	}
90
91
	/**
92
	 * Creates a new Row object and assigns it as the currently active row
93
	 *
94
	 * @param EnumRowType $type The type of the new row, uses Body by default
95
	 *
96
	 * @return $this
97
	 */
98
	public function createRow($type = EnumRowType::Body)
99
	{
100
		$this->currentRow = new Row;
101
		$this->currentRow->setType($type);
0 ignored issues
show
$type is of type object<Fuel\Common\Table\EnumRowType>, but the function expects a integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
102
103
		return $this;
104
	}
105
106
	/**
107
	 * Adds the Row that's currently being constructed to the list of finished Rows
108
	 *
109
	 * @return $this
110
	 */
111
	public function addRow()
112
	{
113
		switch ( $this->currentRow->getType() )
114
		{
115
			case EnumRowType::Body:
116
				$this->rows[] = $this->currentRow;
117
				break;
118
			case EnumRowType::Header:
119
				$this->headerRows[] = $this->currentRow;
120
				break;
121
			case EnumRowType::Footer:
122
				$this->footerRows[] = $this->currentRow;
123
				break;
124
			default:
125
				throw new \InvalidArgumentException('Unknown row type');
126
		}
127
128
		$this->currentRow = null;
129
130
		return $this;
131
	}
132
133
	/**
134
	 * Returns a list of all currently consructed Rows
135
	 *
136
	 * @return array
137
	 */
138
	public function getRows()
139
	{
140
		return $this->rows;
141
	}
142
143
	/**
144
	 * Returns a list of currently constructed header rows
145
	 *
146
	 * @return array
147
	 */
148
	public function getHeaderRows()
149
	{
150
		return $this->headerRows;
151
	}
152
153
	/**
154
	 * Returns a list of currently constructed footer rows
155
	 *
156
	 * @return array
157
	 */
158
	public function getFooterRows()
159
	{
160
		return $this->footerRows;
161
	}
162
163
	/**
164
	 * Gets the currently active row. The row will not be added until addRow() is called
165
	 *
166
	 * @return Row
167
	 */
168
	public function getCurrentRow()
169
	{
170
		if ( is_null($this->currentRow) )
171
		{
172
			$this->createRow();
173
		}
174
175
		return $this->currentRow;
176
	}
177
178
	/**
179
	 * Sets the attributes for the currently active Row
180
	 *
181
	 * @param array $attributes
182
	 *
183
	 * @return $this
184
	 */
185
	public function setCurrentRowAttributes(array $attributes)
186
	{
187
		$this->getCurrentRow()->setAttributes($attributes);
188
189
		return $this;
190
	}
191
192
	/**
193
	 * Returns the attributes of this Table
194
	 *
195
	 * @return array
196
	 */
197
	public function getAttributes()
198
	{
199
		return $this->attributes;
200
	}
201
202
	/**
203
	 * Sets the atributes of the Table
204
	 *
205
	 * @param array $newAttributes
206
	 *
207
	 * @return $this
208
	 */
209
	public function setAttributes(array $newAttributes)
210
	{
211
		$this->attributes = $newAttributes;
212
213
		return $this;
214
	}
215
}
216