Issues (25)

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.

EventDispatching/AggregateChildEventException.php (3 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
namespace Workana\AsyncJobs\EventDispatching;
3
4
use Exception;
5
use ReflectionFunction;
6
7
/**
8
 * Aggregate child of event exception
9
 *
10
 * @author Carlos Frutos <[email protected]>
11
 */
12
class AggregateChildEventException extends Exception
13
{
14
    /**
15
     * @var AggregateRootEventException
16
     */
17
    protected $parent;
18
19
    /**
20
     * @var Callable
21
     */
22
    protected $listener;
23
24
    /**
25
     * @var string
26
     */
27
    protected $listenerName;
28
29
    /**
30
     * @var Throwable|Exception
31
     */
32
    protected $wrappedError;
33
34
    /**
35
     * @var AggregateRootEventException $parent
36
     * @var Callable $listener
37
     * @var Exception|Throwable $wrappedError
38
     */
39
    public function __construct(
40
        AggregateRootEventException $parent,
41
        Callable $listener,
42
        $wrappedError
43
    ) {
44
        $this->parent = $parent;
45
        $this->listener = $listener;
46
        $this->listenerName = $this->calculateListenerName($listener);
47
        $this->wrappedError = $wrappedError;
48
49
        parent::__construct(strtr('Failed event :eventName on listener :listenerName with message: :errorMessage', [
50
            ':eventName' => $this->parent->getEventName(),
51
            ':listenerName' => $this->listenerName,
52
            ':errorMessage' => $this->wrappedError->getMessage(),
53
        ]));
54
    }
55
56
    /**
57
     * Calculate listener name
58
     *
59
     * @param Callable $listener
60
     *
61
     * @return string
62
     */
63
    private function calculateListenerName(Callable $listener)
64
    {
65
        if (is_array($listener)) {
66
            $class = is_object($listener[0]) ? get_class($listener[0]) : (string) $listener[0];
67
68
            return implode('::', [$class, $listener[1]]);
69
        } elseif ($listener instanceof Closure) {
0 ignored issues
show
The class Workana\AsyncJobs\EventDispatching\Closure does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
70
            $reflection = new ReflectionFunction($callable);
0 ignored issues
show
The variable $callable does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
71
72
            return "[closure]#{$reflection->getFileName()}:{$reflection->getStartLine()}";
73
        } elseif (is_string($listener)) {
74
            return $listener;
75
        } elseif (is_object($listener)) {
76
            $class = get_class($listener);
0 ignored issues
show
$class is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
77
78
            return "[invokable]#{class}";
79
        }
80
    }
81
82
    public function getEventName()
83
    {
84
        return $this->parent->getEventName();
85
    }
86
87
    public function getEvent()
88
    {
89
        return $this->parent->getEvent();
90
    }
91
92
    public function getListener()
93
    {
94
        return $this->listener;
95
    }
96
97
    public function getListenerName()
98
    {
99
        return $this->listenerName;
100
    }
101
102
    public function getWrappedError()
103
    {
104
        return $this->wrappedError;
105
    }
106
}