Issues (3099)

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/Kunstmaan/AdminBundle/Entity/Exception.php (5 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
namespace Kunstmaan\AdminBundle\Entity;
4
5
use DateTimeInterface;
6
use Doctrine\ORM\Mapping as ORM;
7
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
8
9
/**
10
 * @ORM\Entity(repositoryClass="Kunstmaan\AdminBundle\Repository\ExceptionRepository")
11
 * @ORM\Table(
12
 *      name="kuma_exception",
13
 *      indexes={
14
 *          @ORM\Index(name="idx_exception_is_resolved", columns={"is_resolved"})
15
 *      }
16
 * )
17
 * @UniqueEntity("hash")
18
 * @ORM\HasLifecycleCallbacks()
19
 */
20
class Exception extends AbstractEntity
21
{
22
    /**
23
     * @var string
24
     *
25
     * @ORM\Column(type="string", length=3)
26
     */
27
    private $code;
28
29
    /**
30
     * @var string
31
     *
32
     * @ORM\Column(type="text")
33
     */
34
    private $url;
35
36
    /**
37
     * @var string
38
     *
39
     * @ORM\Column(type="text", nullable=true)
40
     */
41
    private $urlReferer;
42
43
    /**
44
     * @var string
45
     *
46
     * @ORM\Column(type="string", nullable=false, unique=true, length=32)
47
     */
48
    private $hash;
49
50
    /**
51
     * @var int
52
     *
53
     * @ORM\Column(type="integer", nullable=false)
54
     */
55
    private $events;
56
57
    /**
58
     * @var bool
59
     *
60
     * @ORM\Column(type="boolean", name="is_resolved")
61
     */
62
    private $isResolved;
63
64
    /**
65
     * @var \DateTime
66
     *
67
     * @ORM\Column(type="datetime", name="created_at")
68
     */
69
    private $createdAt;
70
71
    /**
72
     * @var \DateTime
73
     *
74
     * @ORM\Column(type="datetime", name="updated_at")
75
     */
76
    private $updatedAt;
77
78
    public function __construct()
79
    {
80
        $this->isResolved = false;
81
        $this->setCreatedAt(new \DateTime());
82
        $this->setUpdatedAt(new \DateTime());
83
        $this->setEvents(1);
84
    }
85
86
    /**
87
     * @return string
88
     */
89
    public function getCode()
90
    {
91
        return $this->code;
92
    }
93
94
    /**
95
     * @param string $code
96
     */
97
    public function setCode($code)
98
    {
99
        $this->code = $code;
100
    }
101
102
    /**
103
     * @return string
104
     */
105
    public function getUrl()
106
    {
107
        return $this->url;
108
    }
109
110
    /**
111
     * @param string $url
112
     */
113
    public function setUrl($url)
114
    {
115
        $this->url = $url;
116
    }
117
118
    /**
119
     * @return string
120
     */
121
    public function getUrlReferer()
122
    {
123
        return $this->urlReferer;
124
    }
125
126
    /**
127
     * @param string $urlReferer
128
     */
129
    public function setUrlReferer($urlReferer)
130
    {
131
        $this->urlReferer = $urlReferer;
132
    }
133
134
    /**
135
     * @return string
136
     */
137
    public function getHash()
138
    {
139
        return $this->hash;
140
    }
141
142
    /**
143
     * @param string $hash
144
     */
145
    public function setHash($hash)
146
    {
147
        $this->hash = $hash;
148
    }
149
150
    /**
151
     * @return int
152
     */
153
    public function getEvents()
154
    {
155
        return $this->events;
156
    }
157
158
    /**
159
     * @param int $triggered
0 ignored issues
show
There is no parameter named $triggered. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
160
     */
161
    public function setEvents($events)
162
    {
163
        $this->events = $events;
164
    }
165
166
    public function increaseEvents()
167
    {
168
        ++$this->events;
169
    }
170
171
    /**
172
     * @return bool
173
     */
174
    public function isResolved()
175
    {
176
        return (bool) $this->isResolved;
177
    }
178
179
    /**
180
     * @param bool $isResolved
181
     */
182
    public function setResolved($isResolved)
183
    {
184
        $this->isResolved = $isResolved;
185
    }
186
187
    /**
188
     * @return \DateTime
189
     */
190
    public function getCreatedAt()
191
    {
192
        return $this->createdAt;
193
    }
194
195
    /**
196
     * @param \DateTime $createdAt
0 ignored issues
show
Should the type for parameter $createdAt not be DateTimeInterface?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
197
     */
198
    public function setCreatedAt(DateTimeInterface $createdAt)
199
    {
200
        $this->createdAt = $createdAt;
0 ignored issues
show
Documentation Bug introduced by
$createdAt is of type object<DateTimeInterface>, but the property $createdAt was declared to be of type object<DateTime>. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
201
    }
202
203
    /**
204
     * @return \DateTime
205
     */
206
    public function getUpdatedAt()
207
    {
208
        return $this->updatedAt;
209
    }
210
211
    /**
212
     * @param \DateTime $updatedAt
0 ignored issues
show
Should the type for parameter $updatedAt not be DateTimeInterface?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
213
     */
214
    public function setUpdatedAt(DateTimeInterface $updatedAt)
215
    {
216
        $this->updatedAt = $updatedAt;
0 ignored issues
show
Documentation Bug introduced by
$updatedAt is of type object<DateTimeInterface>, but the property $updatedAt was declared to be of type object<DateTime>. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
217
    }
218
219
    /**
220
     * @ORM\PreUpdate()
221
     */
222
    public function preUpdate()
223
    {
224
        $this->setUpdatedAt(new \DateTime());
225
    }
226
}
227