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.

src/Prophecy/Call/Call.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
/*
4
 * This file is part of the Prophecy.
5
 * (c) Konstantin Kudryashov <[email protected]>
6
 *     Marcello Duarte <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Prophecy\Call;
13
14
use Exception;
15
use Prophecy\Argument\ArgumentsWildcard;
16
17
/**
18
 * Call object.
19
 *
20
 * @author Konstantin Kudryashov <[email protected]>
21
 */
22
class Call
23
{
24
    private $methodName;
25
    private $arguments;
26
    private $returnValue;
27
    private $exception;
28
    private $file;
29
    private $line;
30
    private $scores;
31
32
    /**
33
     * Initializes call.
34
     *
35
     * @param string      $methodName
36
     * @param array       $arguments
37
     * @param mixed       $returnValue
38
     * @param Exception   $exception
39
     * @param null|string $file
40
     * @param null|int    $line
41
     */
42
    public function __construct($methodName, array $arguments, $returnValue,
43
                                Exception $exception = null, $file, $line)
44
    {
45
        $this->methodName  = $methodName;
46
        $this->arguments   = $arguments;
47
        $this->returnValue = $returnValue;
48
        $this->exception   = $exception;
49
        $this->scores      = new \SplObjectStorage();
50
51
        if ($file) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $file of type null|string is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
52
            $this->file = $file;
53
            $this->line = intval($line);
54
        }
55
    }
56
57
    /**
58
     * Returns called method name.
59
     *
60
     * @return string
61
     */
62
    public function getMethodName()
63
    {
64
        return $this->methodName;
65
    }
66
67
    /**
68
     * Returns called method arguments.
69
     *
70
     * @return array
71
     */
72
    public function getArguments()
73
    {
74
        return $this->arguments;
75
    }
76
77
    /**
78
     * Returns called method return value.
79
     *
80
     * @return null|mixed
81
     */
82
    public function getReturnValue()
83
    {
84
        return $this->returnValue;
85
    }
86
87
    /**
88
     * Returns exception that call thrown.
89
     *
90
     * @return null|Exception
91
     */
92
    public function getException()
93
    {
94
        return $this->exception;
95
    }
96
97
    /**
98
     * Returns callee filename.
99
     *
100
     * @return string
101
     */
102
    public function getFile()
103
    {
104
        return $this->file;
105
    }
106
107
    /**
108
     * Returns callee line number.
109
     *
110
     * @return int
111
     */
112
    public function getLine()
113
    {
114
        return $this->line;
115
    }
116
117
    /**
118
     * Returns short notation for callee place.
119
     *
120
     * @return string
121
     */
122
    public function getCallPlace()
123
    {
124
        if (null === $this->file) {
125
            return 'unknown';
126
        }
127
128
        return sprintf('%s:%d', $this->file, $this->line);
129
    }
130
131
    /**
132
     * Adds the wildcard match score for the provided wildcard.
133
     *
134
     * @param ArgumentsWildcard $wildcard
135
     * @param false|int $score
136
     *
137
     * @return $this
138
     */
139
    public function addScore(ArgumentsWildcard $wildcard, $score)
140
    {
141
        $this->scores[$wildcard] = $score;
142
143
        return $this;
144
    }
145
146
    /**
147
     * Returns wildcard match score for the provided wildcard. The score is
148
     * calculated if not already done.
149
     *
150
     * @param ArgumentsWildcard $wildcard
151
     *
152
     * @return false|int False OR integer score (higher - better)
153
     */
154
    public function getScore(ArgumentsWildcard $wildcard)
155
    {
156
        if (isset($this->scores[$wildcard])) {
157
            return $this->scores[$wildcard];
158
        }
159
160
        return $this->scores[$wildcard] = $wildcard->scoreArguments($this->getArguments());
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->scores[$wildcard]...$this->getArguments()); of type integer|false|double adds the type double to the return on line 160 which is incompatible with the return type documented by Prophecy\Call\Call::getScore of type false|integer.
Loading history...
161
    }
162
}
163