Issues (117)

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.

spec/Prophecy/Promise/ThrowPromiseSpec.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
3
namespace spec\Prophecy\Promise;
4
5
use PhpSpec\Exception\Example\SkippingException;
6
use PhpSpec\ObjectBehavior;
7
use Prophecy\Prophecy\MethodProphecy;
8
use Prophecy\Prophecy\ObjectProphecy;
9
10
class ThrowPromiseSpec extends ObjectBehavior
11
{
12
    function let()
13
    {
14
        $this->beConstructedWith('RuntimeException');
15
    }
16
17
    function it_is_promise()
18
    {
19
        $this->shouldBeAnInstanceOf('Prophecy\Promise\PromiseInterface');
20
    }
21
22
    function it_instantiates_and_throws_exception_from_provided_classname(ObjectProphecy $object, MethodProphecy $method)
23
    {
24
        $this->beConstructedWith('InvalidArgumentException');
25
26
        $this->shouldThrow('InvalidArgumentException')
27
            ->duringExecute(array(), $object, $method);
28
    }
29
30
    function it_instantiates_exceptions_with_required_arguments(ObjectProphecy $object, MethodProphecy $method)
31
    {
32
        $this->beConstructedWith('spec\Prophecy\Promise\RequiredArgumentException');
33
34
        $this->shouldThrow('spec\Prophecy\Promise\RequiredArgumentException')
35
            ->duringExecute(array(), $object, $method);
36
    }
37
38
    function it_throws_provided_exception(ObjectProphecy $object, MethodProphecy $method)
39
    {
40
        $this->beConstructedWith($exc = new \RuntimeException('Some exception'));
41
42
        $this->shouldThrow($exc)->duringExecute(array(), $object, $method);
43
    }
44
45
    function it_throws_error_instances(ObjectProphecy $object, MethodProphecy $method)
46
    {
47
        if (!class_exists('\Error')) {
48
            throw new SkippingException('The class Error, introduced in PHP 7, does not exist');
49
        }
50
51
        $this->beConstructedWith($exc = new \Error('Error exception'));
52
53
        $this->shouldThrow($exc)->duringExecute(array(), $object, $method);
54
    }
55
56 View Code Duplication
    function it_throws_errors_by_class_name()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
57
    {
58
        if (!class_exists('\Error')) {
59
            throw new SkippingException('The class Error, introduced in PHP 7, does not exist');
60
        }
61
62
        $this->beConstructedWith('\Error');
63
64
        $this->shouldNotThrow('Prophecy\Exception\InvalidArgumentException')->duringInstantiation();
65
    }
66
67
    function it_does_not_throw_something_that_is_not_throwable_by_class_name()
68
    {
69
        $this->beConstructedWith('\stdClass');
70
71
        $this->shouldThrow('Prophecy\Exception\InvalidArgumentException')->duringInstantiation();
72
    }
73
74
    function it_does_not_throw_something_that_is_not_throwable_by_instance()
75
    {
76
        $this->beConstructedWith(new \stdClass());
77
78
        $this->shouldThrow('Prophecy\Exception\InvalidArgumentException')->duringInstantiation();
79
    }
80
81
    function it_throws_an_exception_by_class_name()
82
    {
83
        $this->beConstructedWith('\Exception');
84
85
        $this->shouldNotThrow('Prophecy\Exception\InvalidArgumentException')->duringInstantiation();
86
    }
87
88 View Code Duplication
    function it_throws_an_extension_of_throwable_by_class_name()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
89
    {
90
        if (!interface_exists('\Throwable')) {
91
            throw new SkippingException('The interface Throwable, introduced in PHP 7, does not exist');
92
        }
93
94
        $this->beConstructedWith('\Fixtures\Prophecy\ThrowableInterface');
95
96
        $this->shouldNotThrow('Prophecy\Exception\InvalidArgumentException')->duringInstantiation();
97
    }
98
99 View Code Duplication
    function it_throws_a_throwable_by_class_name()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
100
    {
101
        if (!interface_exists('\Throwable')) {
102
            throw new SkippingException('The interface Throwable, introduced in PHP 7, does not exist');
103
        }
104
105
        $this->beConstructedWith('\Throwable');
106
107
        $this->shouldNotThrow('Prophecy\Exception\InvalidArgumentException')->duringInstantiation();
108
    }
109
}
110
111
class RequiredArgumentException extends \Exception
112
{
113
    final public function __construct($message, $code) {}
114
}
115