Issues (496)

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.

src/Soap/SoapClient.php (8 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 Bludata\Soap;
4
5
use InvalidArgumentException;
6
use SoapClient as NativeSoapClient;
7
8
class SoapClient
9
{
10
    /**
11
     * @var string
12
     */
13
    protected $host;
14
15
    /**
16
     * @var array
17
     */
18
    protected $options;
19
20
    /**
21
     * @var SoapClient
22
     */
23
    protected $client;
24
25
    /**
26
     * @var mixed
27
     */
28
    protected $service;
29
30
    /**
31
     * @var mixed
32
     */
33
    protected $request;
34
35
    /**
36
     * Cria um instancia para comunicação com WSDL utilizando SoapClient.
37
     *
38
     * @param string $host    Parametro obrigatório, endereço do WSDL
39
     * @param array  $options Parametro opcional, referente aos options que serão utilizados
0 ignored issues
show
This line exceeds maximum limit of 80 characters; contains 92 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
40
     */
41
    public function __construct($host, array $options = [])
42
    {
43
        $this->setHost($host)
44
            ->setOptions($options);
45
    }
46
47
    /**
48
     * Efetua a conexão inicial com o WSDL.
49
     *
50
     * @return self
51
     */
52
    public function connect()
53
    {
54
        if (!$host = $this->getHost()) {
55
            throw new InvalidArgumentException('Host não informado');
56
        }
57
58
        if (!$this->client) {
59
            $this->client = new NativeSoapClient($host, $this->getOptions());
0 ignored issues
show
Documentation Bug introduced by
It seems like new \SoapClient($host, $this->getOptions()) of type object<SoapClient> is incompatible with the declared type object<Bludata\Soap\SoapClient> of property $client.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
60
        }
61
62
        return $this;
63
    }
64
65
    /**
66
     * Faz a chamada para o WSDL, de acordo com os parametros pré-configurados para o serviço.
0 ignored issues
show
This line exceeds maximum limit of 80 characters; contains 94 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
67
     *
68
     * @return SoapClient::__soapCall
0 ignored issues
show
The doc-type SoapClient::__soapCall could not be parsed: Unknown type name "SoapClient::__soapCall" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
69
     */
70
    public function call()
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
71
    {
72
        $host = $this->getHost();
73
        if (!$host || empty($host)) {
74
            throw new InvalidArgumentException('Host não informado');
75
        }
76
77
        $service = $this->getService();
78
        if (!$service || empty($service)) {
79
            throw new InvalidArgumentException('Serviço não informado');
80
        }
81
82
        $request = $this->getRequest();
83
        if (!$request || empty($request)) {
84
            throw new InvalidArgumentException('Request não informada');
85
        }
86
87
        $this->connect();
88
        $client = $this->getClient();
89
90
        return $client->__soapCall($service, $request);
0 ignored issues
show
The method __soapCall() does not seem to exist on object<Bludata\Soap\SoapClient>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
91
    }
92
93
    /**
94
     * Retorna o host do WSDL.
95
     *
96
     * @return string
97
     */
98
    public function getHost()
99
    {
100
        return $this->host;
101
    }
102
103
    /**
104
     * Recebe o endereço do WSDL.
105
     *
106
     * @param string $host
107
     *
108
     * @return self
109
     */
110
    public function setHost($host)
111
    {
112
        $this->host = $host;
113
114
        return $this;
115
    }
116
117
    /**
118
     * Retorna os options utilizados no SoapClient.
119
     *
120
     * @return array
121
     */
122
    public function getOptions()
123
    {
124
        return $this->options;
125
    }
126
127
    /**
128
     * Recebe os options que serão utilizados no SoapClient.
129
     *
130
     * @param array $options
131
     *
132
     * @return self
133
     */
134
    public function setOptions(array $options)
135
    {
136
        $this->options = $options;
137
138
        return $this;
139
    }
140
141
    /**
142
     * Retorna dados da requisição.
143
     *
144
     * @return mixed
145
     */
146
    public function getRequest()
147
    {
148
        return $this->request;
149
    }
150
151
    /**
152
     * Recebe dados para montar o request.
153
     *
154
     * @param array
155
     *
156
     * @return self
157
     */
158
    public function setRequest($request)
159
    {
160
        $this->request = $request;
161
162
        return $this;
163
    }
164
165
    /**
166
     * Retorna o serviço utilizado.
167
     *
168
     * @return mixed
169
     */
170
    public function getService()
171
    {
172
        return $this->service;
173
    }
174
175
    /**
176
     * Recebe o serviço que sera utilizado no WSDL.
177
     *
178
     * @param string $service
179
     *
180
     * @return self
181
     */
182
    public function setService($service)
183
    {
184
        $this->service = $service;
185
186
        return $this;
187
    }
188
189
    /**
190
     * Retorna a instancia do SoapClient que foi incializada.
191
     *
192
     * @return mixed
193
     */
194
    public function getClient()
195
    {
196
        return $this->client;
197
    }
198
199
    /**
200
     * Recebe o SoapClient que sera utilizado.
201
     *
202
     * @param SoapClient $client
0 ignored issues
show
Should the type for parameter $client not be NativeSoapClient?

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...
203
     *
204
     * @return self
205
     */
206
    public function setClient(NativeSoapClient $client)
207
    {
208
        $this->client = $client;
0 ignored issues
show
Documentation Bug introduced by
It seems like $client of type object<SoapClient> is incompatible with the declared type object<Bludata\Soap\SoapClient> of property $client.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
209
210
        return $this;
211
    }
212
}
213