Issues (387)

Branch: develop

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.

Descriptor/Builder/Reflector/ClassAssembler.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
declare(strict_types=1);
3
4
/**
5
 * This file is part of phpDocumentor.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @author    Mike van Riel <[email protected]>
11
 * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
12
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
13
 * @link      http://phpdoc.org
14
 */
15
16
namespace phpDocumentor\Descriptor\Builder\Reflector;
17
18
use phpDocumentor\Descriptor\ClassDescriptor;
19
use phpDocumentor\Descriptor\Collection;
20
use phpDocumentor\Descriptor\ConstantDescriptor;
21
use phpDocumentor\Descriptor\MethodDescriptor;
22
use phpDocumentor\Descriptor\PropertyDescriptor;
23
use phpDocumentor\Reflection\Php\Class_;
24
use phpDocumentor\Reflection\Php\Constant;
25
use phpDocumentor\Reflection\Php\Method;
26
use phpDocumentor\Reflection\Php\Property;
27
28
/**
29
 * Assembles an ClassDescriptor using an ClassReflector.
30
 */
31
class ClassAssembler extends AssemblerAbstract
32
{
33
    /**
34
     * Creates a Descriptor from the provided data.
35
     *
36
     * @param Class_ $data
37
     *
38
     * @return ClassDescriptor
39
     */
40 1
    public function create($data)
41
    {
42 1
        $classDescriptor = new ClassDescriptor();
43
44 1
        $classDescriptor->setFullyQualifiedStructuralElementName($data->getFqsen());
45 1
        $classDescriptor->setName($data->getName());
46 1
        $classDescriptor->setPackage(
47 1
            $this->extractPackageFromDocBlock($data->getDocBlock()) ?: $this->getBuilder()->getDefaultPackage()
48
        );
49 1
        $classDescriptor->setLine($data->getLocation()->getLineNumber());
50 1
        $classDescriptor->setParent($data->getParent());
0 ignored issues
show
$data->getParent() is of type null|object<phpDocumentor\Reflection\Fqsen>, but the function expects a object<phpDocumentor\Des...tor\DescriptorAbstract>.

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...
51 1
        $classDescriptor->setAbstract($data->isAbstract());
52 1
        $classDescriptor->setFinal($data->isFinal());
53 1
        $classDescriptor->setNamespace(substr((string) $data->getFqsen(), 0, -strlen($data->getName()) - 1));
54
55 1
        foreach ($data->getInterfaces() as $interfaceClassName) {
56 1
            $classDescriptor->getInterfaces()->set((string) $interfaceClassName, $interfaceClassName);
57
        }
58
59 1
        $this->assembleDocBlock($data->getDocBlock(), $classDescriptor);
60
61 1
        $this->addConstants($data->getConstants(), $classDescriptor);
62 1
        $this->addProperties($data->getProperties(), $classDescriptor);
63 1
        $this->addMethods($data->getMethods(), $classDescriptor);
64 1
        $this->addUses($data->getUsedTraits(), $classDescriptor);
65
66 1
        return $classDescriptor;
67
    }
68
69
    /**
70
     * Registers the child constants with the generated Class Descriptor.
71
     *
72
     * @param Constant[] $constants
73
     */
74 1
    protected function addConstants(array $constants, ClassDescriptor $classDescriptor): void
75
    {
76 1
        foreach ($constants as $constant) {
77 1
            $constantDescriptor = $this->getBuilder()->buildDescriptor($constant);
78 1
            if ($constantDescriptor instanceof ConstantDescriptor) {
79
                $constantDescriptor->setParent($classDescriptor);
80 1
                $classDescriptor->getConstants()->set($constantDescriptor->getName(), $constantDescriptor);
81
            }
82
        }
83 1
    }
84
85
    /**
86
     * Registers the child properties with the generated Class Descriptor.
87
     *
88
     * @param Property[] $properties
89
     */
90 1
    protected function addProperties(array $properties, ClassDescriptor $classDescriptor): void
91
    {
92 1
        foreach ($properties as $property) {
93 1
            $propertyDescriptor = $this->getBuilder()->buildDescriptor($property);
94 1
            if ($propertyDescriptor instanceof PropertyDescriptor) {
95
                $propertyDescriptor->setParent($classDescriptor);
96 1
                $classDescriptor->getProperties()->set($propertyDescriptor->getName(), $propertyDescriptor);
97
            }
98
        }
99 1
    }
100
101
    /**
102
     * Registers the child methods with the generated Class Descriptor.
103
     *
104
     * @param Method[] $methods
105
     */
106 1
    protected function addMethods(array $methods, ClassDescriptor $classDescriptor): void
107
    {
108 1
        foreach ($methods as $method) {
109 1
            $methodDescriptor = $this->getBuilder()->buildDescriptor($method);
110 1
            if ($methodDescriptor instanceof MethodDescriptor) {
111
                $methodDescriptor->setParent($classDescriptor);
112 1
                $classDescriptor->getMethods()->set($methodDescriptor->getName(), $methodDescriptor);
113
            }
114
        }
115 1
    }
116
117
    /**
118
     * Registers the used traits with the generated Class Descriptor.
119
     *
120
     * @param string[] $traits
121
     */
122 1
    protected function addUses(array $traits, ClassDescriptor $classDescriptor): void
123
    {
124 1
        $classDescriptor->setUsedTraits(new Collection($traits));
125 1
    }
126
}
127