Issues (8)

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.

src/Knot/Dict/AbstractDictBody.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 namespace Knot\Dict;
2
3
use ArrayAccess;
4
use Countable;
5
use Illuminate\Contracts\Support\Arrayable;
6
use IteratorAggregate;
7
use Knot\Exceptions\FunctionExecuteException;
8
use Knot\Exceptions\WrongArrayPathException;
9
use Knot\Exceptions\WrongFunctionException;
10
11
/**
12
 * PHP ArrayEqualHelper methods
13
 * @method $this merge( array $array1 = null, array $array2 = null, array $_ = null )
14
 * @method $this reverse()
15
 * @method $this values()
16
 *
17
 * @method mixed shift()
18
 * @method mixed unshift( mixed $variable )
19
 * @method mixed push( mixed $variable )
20
 */
21
abstract class AbstractDictBody implements Arrayaccess, Countable, IteratorAggregate, Arrayable {
22
23
	use ArrayAccessTrait, CountableTrait, IteratorAggregateTrait, PathOperationsTrait;
24
25
	/**
26
	 * Knot data.
27
	 * @var array
28
	 */
29
	protected $data;
30
31
	/**
32
	 * @var AbstractDictBody
33
	 */
34
	protected $parentArray;
35
36
37
	/**
38
	 * @return AbstractDictBody
39
	 */
40
	abstract public function kill();
41
42
43
	/**
44
	 * @param array            $data
45
	 * @param AbstractDictBody $parent
46
	 * @param                  $path
47
	 */
48
	public function __construct(array &$data, AbstractDictBody $parent = null, $path = '')
49
	{
50
		$this->data        =& $data;
51
		$this->path        = $path;
52
		$this->parentArray = $parent;
53
	}
54
55
56
	/**
57
	 * @param $key
58
	 * @param $value
59
	 */
60
	public function __set($key, $value)
61
	{
62
		$this->data[$key] = $value;
63
	}
64
65
66
	/**
67
	 * @param string|int $key
68
	 *
69
	 * @return mixed|\Knot\Dict\ChildDict
70
	 * @throws \Exception
71
	 */
72
	public function &__get($key)
73
	{
74
		if ( array_key_exists($key, $this->data) )
75
		{
76
			$target =& $this->data[$key];
77
		}
78
		else
79
		{
80
			throw new WrongArrayPathException($key);
81
		}
82
83
		if ( is_array($target) )
84
		{
85
			$r = new ChildDict($target, $this->childParent(), $this->path($key));
0 ignored issues
show
$key is of type string|integer, but the function expects a null.

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...
86
87
			return $r;
88
		}
89
90
		return $target;
91
	}
92
93
94
	/**
95
	 * Call callable data variable.
96
	 *
97
	 * @param string $methodPath
98
	 * @param array  $arguments
99
	 *
100
	 * @return mixed
101
	 * @throws \Exception
102
	 */
103
	public function call($methodPath, array $arguments = [ ])
104
	{
105
		$function = $this->get($methodPath, false);
106
107
		if ( ! $function || ! is_callable($function) )
108
		{
109
			throw new WrongFunctionException("Wrong function or not callable key!");
110
		}
111
112
		try
113
		{
114
			$arguments = array_merge([ &$this->data ], $arguments);
115
116
			return call_user_func_array($function, $arguments);
117
		}
118
		catch (\Exception $e)
119
		{
120
			throw new FunctionExecuteException($methodPath);
121
		}
122
	}
123
124
125
	/**
126
	 * Function list: Helper Libraries!
127
	 *
128
	 * @param string $method
129
	 * @param array  $arguments
130
	 *
131
	 * @return $this|mixed
132
	 * @throws \Exception|WrongFunctionException
133
	 */
134
	public function __call($method, $arguments = [ ])
135
	{
136
		try
137
		{
138
			return $this->getHelperManager()->execute($method, $arguments, $this);
139
		}
140
		catch (\Exception $e)
141
		{
142
			throw $e;
143
		}
144
	}
145
146
147
	/**
148
	 * @param mixed $key
149
	 *
150
	 * @return bool
151
	 */
152
	public function __isset($key)
153
	{
154
		return isset( $this->data[$key] );
155
	}
156
157
158
	/**
159
	 * @param mixed $key
160
	 */
161
	public function __unset($key)
162
	{
163
		unset( $this->data[$key] );
164
	}
165
166
167
	/**
168
	 * Easy Access for get function!
169
	 *
170
	 * @param $path
171
	 *
172
	 * @return mixed
173
	 */
174
	public function __invoke($path)
175
	{
176
		return $this->get($path);
177
	}
178
179
180
	/**
181
	 * Only search own data keys.
182
	 *
183
	 * @param mixed $key
184
	 *
185
	 * @return bool
186
	 */
187
	public function keyExists($key)
188
	{
189
		return isset( $this->data[$key] );
190
	}
191
192
193
	/**
194
	 * @return HelperManager
195
	 */
196
	public function getHelperManager()
197
	{
198
		return HelperManager::getInstance();
199
	}
200
201
202
	/**
203
	 * @return int|string
204
	 */
205
	public function lastKey()
206
	{
207
		end($this->data);
208
209
		return key($this->data);
210
	}
211
212
213
	/**
214
	 * @return array
215
	 */
216
	public function &toArray()
217
	{
218
		return $this->data;
219
	}
220
221
222
	/**
223
	 * @return ParentDict
224
	 */
225
	public function copy()
226
	{
227
		$_data = $this->data;
228
229
		return new ParentDict($_data, null, '');
230
	}
231
232
233
	/**
234
	 * @return $this
235
	 */
236
	public function childParent()
237
	{
238
		return $this;
239
	}
240
241
}
242