Issues (1131)

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/request/SoapRequestDataHolder.class.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
namespace Agavi\Request;
3
4
// +---------------------------------------------------------------------------+
5
// | This file is part of the Agavi package.                                   |
6
// | Copyright (c) 2005-2011 the Agavi Project.                                |
7
// |                                                                           |
8
// | For the full copyright and license information, please view the LICENSE   |
9
// | file that was distributed with this source code. You can also view the    |
10
// | LICENSE file online at http://www.agavi.org/LICENSE.txt                   |
11
// |   vi: set noexpandtab:                                                    |
12
// |   Local Variables:                                                        |
13
// |   indent-tabs-mode: t                                                     |
14
// |   End:                                                                    |
15
// +---------------------------------------------------------------------------+
16
17
/**
18
 * AgaviSoapRequestDataHolder provides methods for retrieving client request
19
 * information parameters and headers of SOAP calls.
20
 *
21
 * @package    agavi
22
 * @subpackage request
23
 *
24
 * @author     David Zülke <[email protected]>
25
 * @copyright  Authors
26
 * @copyright  The Agavi Project
27
 *
28
 * @since      0.11.0
29
 *
30
 * @version    $Id$
31
 */
32
class SoapRequestDataHolder extends WebserviceRequestDataHolder implements HeadersRequestDataHolderInterface
33
{
34
    /**
35
     * @constant   Constant for source name of HTTP headers.
36
     */
37
    const SOURCE_HEADERS = 'headers';
38
    
39
    /**
40
     * @var        array An array of headers sent with the request.
41
     */
42
    protected $headers = array();
43
    
44
    /**
45
     * Constructor
46
     *
47
     * @param      array $data An associative array of request data source names and
48
     *                   data arrays.
49
     *
50
     * @author     David Zülke <[email protected]>
51
     * @since      0.11.0
52
     */
53
    public function __construct(array $data = array())
54
    {
55
        // SOAP headers
56
        $this->registerSource(self::SOURCE_HEADERS, $this->headers);
57
        
58
        // call the parent ctor which handles the actual loading of the data
59
        parent::__construct($data);
60
    }
61
    
62
    /**
63
     * Clear all headers.
64
     *
65
     * @author     Dominik del Bondio <[email protected]>
66
     * @since      0.11.0
67
     */
68
    public function clearHeaders()
69
    {
70
        $this->headers = array();
71
    }
72
73
    /**
74
     * Retrieve all HTTP headers.
75
     *
76
     * @return     array A list of SOAP headers.
77
     *
78
     * @author     David Zülke <[email protected]>
79
     * @since      0.11.0
80
     */
81
    public function &getHeaders()
82
    {
83
        return $this->headers;
84
    }
85
    
86
    /**
87
     * Get a HTTP header.
88
     *
89
     * @param      string $name Case-insensitive name of a header, using either a hyphen
90
     *                    or an underscore as a separator.
91
     * @param      mixed  $defualt A default value.
0 ignored issues
show
There is no parameter named $defualt. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
92
     *
93
     * @return     string The header value, or null if header wasn't set.
94
     *
95
     * @author     David Zülke <[email protected]>
96
     * @since      0.11.0
97
     */
98
    public function &getHeader($name, $default = null)
99
    {
100
        if (isset($this->headers[$name])) {
101
            return $this->headers[$name];
102
        }
103
104
        return $default;
105
    }
106
    
107
    /**
108
     * Check if a HTTP header exists.
109
     *
110
     * @param      string $name Case-insensitive name of a header, using either a hyphen
111
     *                    or an underscore as a separator.
112
     *
113
     * @return     bool True if the header was sent with the current request.
114
     *
115
     * @author     David Zülke <[email protected]>
116
     * @since      0.11.0
117
     */
118
    public function hasHeader($name)
119
    {
120
        return isset($this->headers[$name]);
121
    }
122
    
123
    /**
124
     * Checks if there is a value of a header is empty or not set.
125
     *
126
     * @param      string $name The header name.
127
     *
128
     * @return     bool The result.
129
     *
130
     * @author     David Zülke <[email protected]>
131
     * @since      0.11.0
132
     */
133
    public function isHeaderValueEmpty($name)
134
    {
135
        return ($this->getHeader($name) === null);
136
    }
137
    /**
138
     * Set a header.
139
     *
140
     * The header name is normalized before storing it.
141
     *
142
     * @param      string $name A header name.
143
     * @param      mixed  $value A header value.
144
     *
145
     * @author     David Zülke <[email protected]>
146
     * @since      0.11.0
147
     */
148
    public function setHeader($name, $value)
149
    {
150
        $this->headers[$name] = $value;
151
    }
152
153
    /**
154
     * Set an array of headers.
155
     *
156
     * @param      array $headers An associative array of headers and their values.
157
     *
158
     * @author     Dominik del Bondio <[email protected]>
159
     * @since      0.11.0
160
     */
161
    public function setHeaders(array $headers)
162
    {
163
        $this->headers = array_merge($this->headers, $headers);
164
    }
165
166
    /**
167
     * Remove a HTTP header.
168
     *
169
     * @param      string $name Case-insensitive name of a header, using either a hyphen
170
     *                    or an underscore as a separator.
171
     *
172
     * @return     string The value of the removed header, if it had been set.
173
     *
174
     * @author     David Zülke <[email protected]>
175
     * @since      0.11.0
176
     */
177
    public function &removeHeader($name)
178
    {
179
        $retval = null;
180 View Code Duplication
        if (isset($this->headers[$name])) {
0 ignored issues
show
This code seems to be duplicated across 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...
181
            $retval =& $this->headers[$name];
182
            unset($this->headers[$name]);
183
        }
184
        return $retval;
185
    }
186
    
187
    /**
188
     * Retrieve an array of header names.
189
     *
190
     * @return     array An indexed array of header names in original PHP format.
191
     *
192
     * @author     David Zülke <[email protected]>
193
     * @since      0.11.0
194
     */
195
    public function getHeaderNames()
196
    {
197
        return array_keys($this->headers);
198
    }
199
    
200
    /**
201
     * Merge in Headers from another request data holder.
202
     *
203
     * @param      RequestDataHolder $other The other request data holder.
204
     *
205
     * @author     David Zülke <[email protected]>
206
     * @since      0.11.0
207
     */
208
    public function mergeHeaders(RequestDataHolder $other)
209
    {
210
        if ($other instanceof HeadersRequestDataHolderInterface) {
211
            $this->setHeaders($other->getHeaders());
212
        }
213
    }
214
}
215