Issues (55)

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/ReflectionClass.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
namespace Benoth\StaticReflection\Reflection;
4
5
class ReflectionClass extends ReflectionClassLike
6
{
7
    use Parts\AbstractTrait;
8
    use Parts\FinalTrait;
9
    use Parts\InterfaceTrait;
10
    use Parts\ConstantTrait;
11
    use Parts\PropertyTrait;
12
    use Parts\TraitUseTrait;
13
14
    protected $parent;
15
16 648
    public function getParent()
17
    {
18 648
        return $this->parent;
19
    }
20
21 630
    public function getParentClass()
22
    {
23 630
        if (!$this->getParent()) {
24 591
            return;
25
        }
26
27
        // Return internal objects Reflection
28 240
        if (class_exists($this->getParent(), false)) {
29 36
            $reflection = new \ReflectionClass($this->getParent());
30 36
            if ($reflection->isInternal()) {
31 36
                return $reflection;
32
            }
33
        }
34
35 204
        return $this->index->getClass($this->getParent());
36
    }
37
38 312
    public function setParent($parent)
39
    {
40 312
        $this->parent = $parent;
41
42 312
        return $this;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function isSubclassOf($className)
49
    {
50
        if (!is_string($className)) {
51
            return false;
52
        }
53
54
        $className = ltrim($className, '\\');
55
        if ($this->hasInterface($className)) {
56
            return true;
57
        }
58
59
        $parent = $this->getParentClass();
60
        while ($parent instanceof self) {
61
            if ($className === $parent->getName()) {
62
                return true;
63
            }
64
65
            $parent = $parent->getParentClass();
66
        }
67
68
        return false;
69
    }
70
71
    /**
72
     * Returns if the class is cloneable.
73
     *
74
     * @return bool
75
     */
76 15
    public function isCloneable()
77
    {
78 15
        if ($this->hasMethod('__clone')) {
79 3
            return $this->getMethod('__clone')->isPublic();
80
        }
81
82 12
        return true;
83
    }
84
85
    /**
86
     * Checks if the class is instantiable.
87
     *
88
     * @return bool
89
     */
90 15
    public function isInstantiable()
91
    {
92 15
        if ($this->hasMethod('__construct')) {
93 12
            return $this->getMethod('__construct')->isPublic();
94
        }
95
96 3
        return true;
97
    }
98
99
    /**
100
     * Checks if an object is an instance of the class.
101
     *
102
     * @param object $object
103
     *
104
     * @return bool
105
     */
106 3
    public function isInstance($object)
107
    {
108 3
        return get_class($object) === $this->getName();
109
    }
110
111
    /**
112
     * Checks if the class is iterateable.
113
     *
114
     * @return bool
115
     */
116 15
    public function isIterateable()
117
    {
118 15
        foreach ($this->getInterfaceNames() as $interfaceName) {
119 9
            if (trim($interfaceName, '\\') === 'Iterator') {
120 6
                return true;
121
            }
122 9
        }
123
124 9
        return false;
125
    }
126
127
    /**
128
     * Creates a new class instance from given arguments.
129
     *
130
     * @throws \ReflectionException Always... Can't be implemented.
131
     *
132
     * @return object
133
     */
134 15
    public function newInstance()
135
    {
136 15
        throw new \ReflectionException('StaticReflection can\'t create instances');
137
    }
138
139
    /**
140
     * Creates a new instance of the class, the given arguments are passed to the class constructor.
141
     *
142
     *
143
     * @param array $args The parameters to be passed to the class constructor as an array.
144
     *
145
     * @throws \ReflectionException Always... Can't be implemented.
146
     *
147
     * @return object
148
     */
149 15
    public function newInstanceArgs(array $args)
0 ignored issues
show
The parameter $args is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
150
    {
151 15
        throw new \ReflectionException('StaticReflection can\'t create instances');
152
    }
153
154
    /**
155
     * Creates a new class instance without invoking the constructor.
156
     *
157
     * @throws \ReflectionException Always... Can't be implemented.
158
     *
159
     * @return object
160
     */
161 15
    public function newInstanceWithoutConstructor()
162
    {
163 15
        throw new \ReflectionException('StaticReflection can\'t create instances');
164
    }
165
}
166