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.

Prophecy/Argument/Token/ExactValueTokenSpec.php (2 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\Argument\Token;
4
5
use PhpSpec\ObjectBehavior;
6
7
class ExactValueTokenSpec extends ObjectBehavior
8
{
9
    function let()
10
    {
11
        $this->beConstructedWith(42);
12
    }
13
14
    function it_implements_TokenInterface()
15
    {
16
        $this->shouldBeAnInstanceOf('Prophecy\Argument\Token\TokenInterface');
17
    }
18
19
    function it_is_not_last()
20
    {
21
        $this->shouldNotBeLast();
22
    }
23
24
    function it_holds_value()
25
    {
26
        $this->getValue()->shouldReturn(42);
27
    }
28
29
    function it_scores_10_if_value_is_equal_to_argument()
30
    {
31
        $this->scoreArgument(42)->shouldReturn(10);
32
        $this->scoreArgument('42')->shouldReturn(10);
33
    }
34
35 View Code Duplication
    function it_scores_10_if_value_is_an_object_and_equal_to_argument()
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...
36
    {
37
        $value = new \DateTime();
38
        $value2 = clone $value;
39
40
        $this->beConstructedWith($value);
41
        $this->scoreArgument($value2)->shouldReturn(10);
42
    }
43
44
    function it_does_not_scores_if_value_is_not_equal_to_argument()
45
    {
46
        $this->scoreArgument(50)->shouldReturn(false);
47
        $this->scoreArgument(new \stdClass())->shouldReturn(false);
48
    }
49
50 View Code Duplication
    function it_does_not_scores_if_value_an_object_and_is_not_equal_to_argument()
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...
51
    {
52
        $value = new ExactValueTokenFixtureB('ABC');
53
        $value2 = new ExactValueTokenFixtureB('CBA');
54
55
        $this->beConstructedWith($value);
56
        $this->scoreArgument($value2)->shouldReturn(false);
57
    }
58
59
    function it_does_not_scores_if_value_type_and_is_not_equal_to_argument()
60
    {
61
        $this->beConstructedWith(false);
62
        $this->scoreArgument(0)->shouldReturn(false);
63
    }
64
65
    function it_generates_proper_string_representation_for_integer()
66
    {
67
        $this->beConstructedWith(42);
68
        $this->__toString()->shouldReturn('exact(42)');
69
    }
70
71
    function it_generates_proper_string_representation_for_string()
72
    {
73
        $this->beConstructedWith('some string');
74
        $this->__toString()->shouldReturn('exact("some string")');
75
    }
76
77
    function it_generates_single_line_representation_for_multiline_string()
78
    {
79
        $this->beConstructedWith("some\nstring");
80
        $this->__toString()->shouldReturn('exact("some\\nstring")');
81
    }
82
83
    function it_generates_proper_string_representation_for_double()
84
    {
85
        $this->beConstructedWith(42.3);
86
        $this->__toString()->shouldReturn('exact(42.3)');
87
    }
88
89
    function it_generates_proper_string_representation_for_boolean_true()
90
    {
91
        $this->beConstructedWith(true);
92
        $this->__toString()->shouldReturn('exact(true)');
93
    }
94
95
    function it_generates_proper_string_representation_for_boolean_false()
96
    {
97
        $this->beConstructedWith(false);
98
        $this->__toString()->shouldReturn('exact(false)');
99
    }
100
101
    function it_generates_proper_string_representation_for_null()
102
    {
103
        $this->beConstructedWith(null);
104
        $this->__toString()->shouldReturn('exact(null)');
105
    }
106
107
    function it_generates_proper_string_representation_for_empty_array()
108
    {
109
        $this->beConstructedWith(array());
110
        $this->__toString()->shouldReturn('exact([])');
111
    }
112
113
    function it_generates_proper_string_representation_for_array()
114
    {
115
        $this->beConstructedWith(array('zet', 42));
116
        $this->__toString()->shouldReturn('exact(["zet", 42])');
117
    }
118
119
    function it_generates_proper_string_representation_for_resource()
120
    {
121
        $resource = fopen(__FILE__, 'r');
122
        $this->beConstructedWith($resource);
123
        $this->__toString()->shouldReturn('exact(stream:'.$resource.')');
124
    }
125
126 View Code Duplication
    function it_generates_proper_string_representation_for_object(\stdClass $object)
127
    {
128
        $objHash = sprintf('exact(%s:%s',
129
            get_class($object->getWrappedObject()),
130
            spl_object_hash($object->getWrappedObject())
131
        ) . " Object (\n    'objectProphecyClosure' => Closure:%s Object (\n        0 => Closure:%s Object\n    )\n))";
132
133
        $this->beConstructedWith($object);
134
135
        $hashRegexExpr = '[a-f0-9]{32}';
136
        $this->__toString()->shouldMatch(sprintf('/^%s$/', sprintf(preg_quote("$objHash"), $hashRegexExpr, $hashRegexExpr)));
137
    }
138
}
139
140
class ExactValueTokenFixtureA
141
{
142
    public $errors;
143
}
144
145
class ExactValueTokenFixtureB extends ExactValueTokenFixtureA
146
{
147
    public $errors;
148
    public $value = null;
149
150
    public function __construct($value)
151
    {
152
        $this->value = $value;
153
    }
154
}
155