Issues (1507)

Security Analysis    not enabled

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.

PHPDaemon/Clients/Memcache/Pool.php (19 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 PHPDaemon\Clients\Memcache;
3
4
/**
5
 * @package    Network clients
6
 * @subpackage MemcacheClient
7
 * @author     Vasily Zorin <[email protected]>
8
 */
9
class Pool extends \PHPDaemon\Network\Client
10
{
11
12
    /**
13
     * Gets the key
14
     * @param  string $key Key
15
     * @param  callable $onResponse Callback called when response received
16
     * @callback $onResponse ( )
17
     * @return void
18
     */
19
    public function get($key, $onResponse)
20
    {
21
        $this->requestByKey($key, 'get ' . $this->config->prefix->value . $key . "\r\n", $onResponse);
0 ignored issues
show
The property prefix does not seem to exist in PHPDaemon\Config\Section.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
22
    }
23
24
    /**
25
     * Sets the key
26
     * @param  string $key Key
27
     * @param  string $value Value
28
     * @param  integer $exp Lifetime in seconds (0 - immortal)
29
     * @param  callable $onResponse Callback called when the request complete
0 ignored issues
show
Should the type for parameter $onResponse not be callable|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
30
     * @callback $onResponse ( )
31
     * @return void
32
     */
33 View Code Duplication
    public function set($key, $value, $exp = 0, $onResponse = null)
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...
34
    {
35
        $this->getConnectionByKey($key, function ($conn) use ($key, $value, $exp, $onResponse) {
36
            if (!$conn->connected) {
37
                return;
38
            }
39
            if ($onResponse !== null) {
40
                $conn->onResponse->push($onResponse);
41
                $conn->checkFree();
42
            }
43
44
            $conn->writeln(
45
                'set ' . $this->config->prefix->value . $key . ' 0 ' . $exp . ' '
0 ignored issues
show
The property prefix does not seem to exist in PHPDaemon\Config\Section.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
46
                . mb_orig_strlen($value) . ($onResponse === null ? ' noreply' : '') . "\r\n" . $value
47
            );
48
        });
49
    }
50
51
    /**
52
     * Adds the key
53
     * @param  string $key Key
54
     * @param  string $value Value
55
     * @param  integer $exp Lifetime in seconds (0 - immortal)
56
     * @param  callable $onResponse Callback called when the request complete
0 ignored issues
show
Should the type for parameter $onResponse not be callable|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
57
     * @callback $onResponse ( )
58
     * @return void
59
     */
60 View Code Duplication
    public function add($key, $value, $exp = 0, $onResponse = null)
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...
61
    {
62
        $this->getConnectionByKey($key, function ($conn) use ($key, $value, $exp, $onResponse) {
63
            if (!$conn->connected) {
64
                return;
65
            }
66
            if ($onResponse !== null) {
67
                $conn->onResponse->push($onResponse);
68
                $conn->checkFree();
69
            }
70
            $conn->writeln('add ' . $this->config->prefix->value . $key . ' 0 ' . $exp . ' ' . mb_orig_strlen($value)
0 ignored issues
show
The property prefix does not seem to exist in PHPDaemon\Config\Section.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
71
                . ($onResponse === null ? ' noreply' : '') . "\r\n" . $value);
72
        });
73
    }
74
75
    /**
76
     * Deletes the key
77
     * @param  string $key Key
78
     * @param  callable $onResponse Callback called when the request complete
0 ignored issues
show
Should the type for parameter $onResponse not be callable|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
79
     * @param  integer $time Time to block this key
80
     * @callback $onResponse ( )
81
     * @return void
82
     */
83
    public function delete($key, $onResponse = null, $time = 0)
84
    {
85
        $this->getConnectionByKey($key, function ($conn) use ($key, $time, $onResponse) {
86
            if (!$conn->connected) {
87
                return;
88
            }
89
            if ($onResponse !== null) {
90
                $conn->onResponse->push($onResponse);
91
                $conn->checkFree();
92
            }
93
            $conn->writeln('delete ' . $this->config->prefix->value . $key . ' ' . $time);
0 ignored issues
show
The property prefix does not seem to exist in PHPDaemon\Config\Section.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
94
        });
95
    }
96
97
    /**
98
     * Replaces the key
99
     * @param  string $key Key
100
     * @param  string $value Value
101
     * @param  integer $exp Lifetime in seconds (0 - immortal)
102
     * @param  callable $onResponse Callback called when the request complete
0 ignored issues
show
Should the type for parameter $onResponse not be callable|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
103
     * @callback $onResponse ( )
104
     * @return void
105
     */
106 View Code Duplication
    public function replace($key, $value, $exp = 0, $onResponse = null)
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...
107
    {
108
        $this->getConnectionByKey($key, function ($conn) use ($key, $value, $exp, $onResponse) {
109
            if (!$conn->connected) {
110
                return;
111
            }
112
            if ($onResponse !== null) {
113
                $conn->onResponse->push($onResponse);
114
                $conn->checkFree();
115
            }
116
            $conn->writeln('replace ' . $this->config->prefix->value . $key . ' 0 ' . $exp . ' ' . mb_orig_strlen($value)
0 ignored issues
show
The property prefix does not seem to exist in PHPDaemon\Config\Section.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
117
                . ($onResponse === null ? ' noreply' : '') . "\r\n" . $value);
118
        });
119
    }
120
121
    /**
122
     * Appends a string to the key's value
123
     * @param  string $key Key
124
     * @param  string $value Value
125
     * @param  integer $exp Lifetime in seconds (0 - immortal)
126
     * @param  callable $onResponse Callback called when the request complete
0 ignored issues
show
Should the type for parameter $onResponse not be callable|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
127
     * @callback $onResponse ( )
128
     * @return void
129
     */
130 View Code Duplication
    public function append($key, $value, $exp = 0, $onResponse = null)
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...
131
    {
132
        $this->getConnectionByKey($key, function ($conn) use ($key, $value, $exp, $onResponse) {
133
            if (!$conn->connected) {
134
                return;
135
            }
136
            if ($onResponse !== null) {
137
                $conn->onResponse->push($onResponse);
138
                $conn->checkFree();
139
            }
140
            $conn->writeln('replace ' . $this->config->prefix->value . $key . ' 0 ' . $exp . ' ' . mb_orig_strlen($value)
0 ignored issues
show
The property prefix does not seem to exist in PHPDaemon\Config\Section.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
141
                . ($onResponse === null ? ' noreply' : '') . "\r\n" . $value);
142
        });
143
    }
144
145
    /**
146
     * Prepends a string to the key's value
147
     * @param  string $key Key
148
     * @param  string $value Value
149
     * @param  integer $exp Lifetime in seconds (0 - immortal)
150
     * @param  callable $onResponse Callback called when the request complete
0 ignored issues
show
Should the type for parameter $onResponse not be callable|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
151
     * @callback $onResponse ( )
152
     * @return void
153
     */
154 View Code Duplication
    public function prepend($key, $value, $exp = 0, $onResponse = null)
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...
155
    {
156
        $this->getConnectionByKey($key, function ($conn) use ($key, $value, $exp, $onResponse) {
157
            if (!$conn->connected) {
158
                return;
159
            }
160
            if ($onResponse !== null) {
161
                $conn->onResponse->push($onResponse);
162
                $conn->setFree(false);
163
            }
164
            $conn->writeln('prepend ' . $this->config->prefix->value . $key . ' 0 ' . $exp . ' ' . mb_orig_strlen($value)
0 ignored issues
show
The property prefix does not seem to exist in PHPDaemon\Config\Section.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
165
                . ($onResponse === null ? ' noreply' : '') . "\r\n" . $value);
166
        });
167
    }
168
169
    /**
170
     * Gets a statistics
171
     * @param  callable $onResponse Callback called when the request complete
172
     * @param  string $server Server
0 ignored issues
show
Should the type for parameter $server not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
173
     * @return void
174
     */
175
    public function stats($onResponse, $server = null)
176
    {
177
        $this->requestByServer($server, 'stats' . "\r\n", $onResponse);
178
    }
179
180
    /**
181
     * Setting default config options
182
     * Overriden from NetworkClient::getConfigDefaults
183
     * @return array|bool
184
     */
185
    protected function getConfigDefaults()
186
    {
187
        return [
188
            /* [string|array] Default servers */
189
            'servers' => 'tcp://127.0.0.1',
190
191
            /* [integer] Default port */
192
            'port' => 11211,
193
194
            /* [integer] Maximum connections per server */
195
            'maxconnperserv' => 32,
196
197
            'prefix' => '',
198
        ];
199
    }
200
}
201