Issues (127)

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/Reflection/Adapter/ReflectionProperty.php (1 issue)

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
declare(strict_types=1);
4
5
namespace Roave\BetterReflection\Reflection\Adapter;
6
7
use Exception;
8
use ReflectionException as CoreReflectionException;
9
use ReflectionProperty as CoreReflectionProperty;
10
use Roave\BetterReflection\Reflection\Exception\NoObjectProvided;
11
use Roave\BetterReflection\Reflection\Exception\NotAnObject;
12
use Roave\BetterReflection\Reflection\ReflectionProperty as BetterReflectionProperty;
13
use Throwable;
14
15
class ReflectionProperty extends CoreReflectionProperty
16
{
17
    /** @var BetterReflectionProperty */
18
    private $betterReflectionProperty;
19
20
    /** @var bool */
21
    private $accessible = false;
22
23 21
    public function __construct(BetterReflectionProperty $betterReflectionProperty)
24
    {
25 21
        $this->betterReflectionProperty = $betterReflectionProperty;
26 21
    }
27
28
    /**
29
     * {@inheritDoc}
30
     *
31 1
     * @throws Exception
32
     */
33 1
    public static function export($class, $name, $return = null)
34
    {
35
        throw new Exception('Unable to export statically');
36
    }
37
38
    /**
39 1
     * {@inheritDoc}
40
     */
41 1
    public function __toString()
42
    {
43
        return $this->betterReflectionProperty->__toString();
44
    }
45
46
    /**
47 1
     * {@inheritDoc}
48
     */
49 1
    public function getName()
50
    {
51
        return $this->betterReflectionProperty->getName();
52
    }
53
54
    /**
55 5
     * {@inheritDoc}
56
     */
57 5
    public function getValue($object = null)
58 1
    {
59
        if (! $this->isAccessible()) {
60
            throw new CoreReflectionException('Property not accessible');
61
        }
62 4
63 3
        try {
64 2
            return $this->betterReflectionProperty->getValue($object);
65 1
        } catch (NoObjectProvided | NotAnObject $e) {
66 1
            return null;
67
        } catch (Throwable $e) {
68
            throw new CoreReflectionException($e->getMessage(), 0, $e);
69
        }
70
    }
71
72
    /**
73 5
     * {@inheritDoc}
74
     */
75 5
    public function setValue($object, $value = null)
76 1
    {
77
        if (! $this->isAccessible()) {
78
            throw new CoreReflectionException('Property not accessible');
79
        }
80 4
81 3
        try {
82 2
            $this->betterReflectionProperty->setValue($object, $value);
83 1
        } catch (NoObjectProvided | NotAnObject $e) {
84 1
            return null;
85
        } catch (Throwable $e) {
86 1
            throw new CoreReflectionException($e->getMessage(), 0, $e);
87
        }
88
    }
89
90
    /**
91 9
     * {@inheritDoc}
92
     */
93 9
    public function hasType()
94
    {
95
        return $this->betterReflectionProperty->hasType();
96
    }
97
98
    /**
99 1
     * {@inheritDoc}
100
     */
101 1
    public function getType()
102
    {
103
        return ReflectionType::fromReturnTypeOrNull($this->betterReflectionProperty->getType());
104
    }
105
106
    /**
107 1
     * {@inheritDoc}
108
     */
109 1
    public function isPublic()
110
    {
111
        return $this->betterReflectionProperty->isPublic();
112
    }
113
114
    /**
115 1
     * {@inheritDoc}
116
     */
117 1
    public function isPrivate()
118
    {
119
        return $this->betterReflectionProperty->isPrivate();
120
    }
121
122
    /**
123 1
     * {@inheritDoc}
124
     */
125 1
    public function isProtected()
126
    {
127
        return $this->betterReflectionProperty->isProtected();
128
    }
129
130
    /**
131 1
     * {@inheritDoc}
132
     */
133 1
    public function isStatic()
134
    {
135
        return $this->betterReflectionProperty->isStatic();
136
    }
137
138
    /**
139 1
     * {@inheritDoc}
140
     */
141 1
    public function isDefault()
142
    {
143
        return $this->betterReflectionProperty->isDefault();
144
    }
145
146
    /**
147 2
     * {@inheritDoc}
148
     */
149 2
    public function getModifiers()
150
    {
151
        return $this->betterReflectionProperty->getModifiers();
152
    }
153
154
    /**
155 2
     * {@inheritDoc}
156
     */
157 2
    public function getDeclaringClass()
158 2
    {
159
        return new ReflectionClass($this->betterReflectionProperty->getImplementingClass());
160 10
    }
161
162 10
    /**
163
     * {@inheritDoc}
164
     */
165
    public function getDocComment()
166
    {
167
        return $this->betterReflectionProperty->getDocComment() ?: false;
0 ignored issues
show
Comprehensibility Best Practice introduced by Jaroslav Hanslík
The expression $this->betterReflectionP...tDocComment() ?: false; of type string|false adds false to the return on line 167 which is incompatible with the return type of the parent method ReflectionProperty::getDocComment of type string. It seems like you forgot to handle an error condition.
Loading history...
168
    }
169
170
    /**
171
     * {@inheritDoc}
172
     */
173
    public function setAccessible($accessible)
174
    {
175
        $this->accessible = true;
176
    }
177
178
    public function isAccessible() : bool
179
    {
180
        return $this->accessible || $this->isPublic();
181
    }
182
}
183