This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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\Response; |
||
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 | use Agavi\Dispatcher\OutputType; |
||
17 | |||
18 | /** |
||
19 | * XmlrpcepiphpResponse handles XMLRPC Web Service responses using the |
||
20 | * XMLRPC-EPI extension for PHP. |
||
21 | * |
||
22 | * @package agavi |
||
23 | * @subpackage response |
||
24 | * |
||
25 | * @author David Zülke <[email protected]> |
||
26 | * @copyright Authors |
||
27 | * @copyright The Agavi Project |
||
28 | * |
||
29 | * @since 0.11.0 |
||
30 | * |
||
31 | * @version $Id$ |
||
32 | */ |
||
33 | class XmlrpcepiphpResponse extends Response |
||
34 | { |
||
35 | /** |
||
36 | * @var array The content to send back with this response. |
||
37 | */ |
||
38 | protected $content = array(); |
||
39 | |||
40 | /** |
||
41 | * Check whether or not some content is set. |
||
42 | * |
||
43 | * @return bool If any content is set, false otherwise. |
||
44 | * |
||
45 | * @author David Zülke <[email protected]> |
||
46 | * @since 0.11.6 |
||
47 | */ |
||
48 | public function hasContent() |
||
49 | { |
||
50 | return $this->content !== array(); |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * Set the content for this Response. |
||
55 | * |
||
56 | * @see Response::setContent() |
||
57 | * |
||
58 | * @param array $content The content to be sent in this Response. |
||
59 | * |
||
60 | * @return bool Whether or not the operation was successful. |
||
61 | * |
||
62 | * @author David Zülke <[email protected]> |
||
63 | * @since 0.11.0 |
||
64 | */ |
||
65 | public function setContent($content) |
||
66 | { |
||
67 | return parent::setContent((array) $content); |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * Prepend content to the existing content for this Response. |
||
72 | * |
||
73 | * @param array $content The content to be prepended to this Response. |
||
74 | * |
||
75 | * @return bool Whether or not the operation was successful. |
||
76 | * |
||
77 | * @author David Zülke <[email protected]> |
||
78 | * @since 0.11.0 |
||
79 | */ |
||
80 | public function prependContent($content) |
||
81 | { |
||
82 | return $this->setContent((array) $content + $this->getContent()); |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * Append content to the existing content for this Response. |
||
87 | * |
||
88 | * @param array $content The content to be appended to this Response. |
||
89 | * |
||
90 | * @return bool Whether or not the operation was successful. |
||
91 | * |
||
92 | * @author David Zülke <[email protected]> |
||
93 | * @since 0.11.0 |
||
94 | */ |
||
95 | public function appendContent($content) |
||
96 | { |
||
97 | return $this->setContent($this->getContent() + (array) $content); |
||
98 | } |
||
99 | |||
100 | /** |
||
101 | * Import response metadata (nothing in this case) from another response. |
||
102 | * |
||
103 | * @param Response $otherResponse The other response to import information from. |
||
104 | * |
||
105 | * @author David Zülke <[email protected]> |
||
106 | * @since 0.11.0 |
||
107 | */ |
||
108 | public function merge(Response $otherResponse) |
||
109 | { |
||
110 | parent::merge($otherResponse); |
||
111 | } |
||
112 | |||
113 | /** |
||
114 | * Redirect externally. Not implemented here. |
||
115 | * |
||
116 | * @param mixed $to Where to redirect. |
||
117 | * |
||
118 | * @throws \BadMethodCallException |
||
119 | * |
||
120 | * @author David Zülke <[email protected]> |
||
121 | * @since 0.11.0 |
||
122 | */ |
||
123 | public function setRedirect($to) |
||
124 | { |
||
125 | throw new \BadMethodCallException('Redirects are not implemented for XMLRPC.'); |
||
126 | } |
||
127 | |||
128 | /** |
||
129 | * Get info about the set redirect. Not implemented here. |
||
130 | * |
||
131 | * @throws \BadMethodCallException |
||
132 | * |
||
133 | * @author David Zülke <[email protected]> |
||
134 | * @since 0.11.0 |
||
135 | */ |
||
136 | public function getRedirect() |
||
137 | { |
||
138 | throw new \BadMethodCallException('Redirects are not implemented for XMLRPC.'); |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | * Check if a redirect is set. Not implemented here. |
||
143 | * |
||
144 | * @return bool true, if a redirect is set, otherwise false |
||
145 | * |
||
146 | * @throws \BadMethodCallException |
||
147 | * |
||
148 | * @author David Zülke <[email protected]> |
||
149 | * @since 0.11.0 |
||
150 | */ |
||
151 | public function hasRedirect() |
||
152 | { |
||
153 | throw new \BadMethodCallException('Redirects are not implemented for XMLRPC.'); |
||
154 | } |
||
155 | |||
156 | /** |
||
157 | * Clear any set redirect information. Not implemented here. |
||
158 | * |
||
159 | * @throws \BadMethodCallException |
||
160 | * |
||
161 | * @author David Zülke <[email protected]> |
||
162 | * @since 0.11.0 |
||
163 | */ |
||
164 | public function clearRedirect() |
||
165 | { |
||
166 | throw new \BadMethodCallException('Redirects are not implemented for XMLRPC.'); |
||
167 | } |
||
168 | |||
169 | /** |
||
170 | * @see Response::isMutable() |
||
171 | * |
||
172 | * @author David Zülke <[email protected]> |
||
173 | * @since 0.11.0 |
||
174 | */ |
||
175 | public function isContentMutable() |
||
176 | { |
||
177 | return false; |
||
178 | } |
||
179 | |||
180 | /** |
||
181 | * Clear the content for this Response |
||
182 | * |
||
183 | * @return bool Whether or not the operation was successful. |
||
184 | * |
||
185 | * @author David Zülke <[email protected]> |
||
186 | * @since 0.11.0 |
||
187 | */ |
||
188 | public function clearContent() |
||
189 | { |
||
190 | $this->content = array(); |
||
191 | return true; |
||
192 | } |
||
193 | |||
194 | /** |
||
195 | * Send all response data to the client. |
||
196 | * |
||
197 | * @author David Zülke <[email protected]> |
||
198 | * @since 0.11.0 |
||
199 | */ |
||
200 | public function send(OutputType $outputType = null) |
||
201 | { |
||
202 | $encoding = array('encoding' => $this->getParameter('output_options[encoding]', 'utf-8')); |
||
203 | if ($outputType) { |
||
204 | $encoding = array('encoding' => $outputType->getParameter('encoding', $encoding['encoding'])); |
||
205 | } |
||
206 | |||
207 | $outputOptions = array_merge(array('escaping' => array('markup', 'non-print')), (array) $this->getParameter('output_options', array()), $encoding); |
||
208 | |||
209 | $this->content = xmlrpc_encode_request(null, $this->content, $outputOptions); |
||
0 ignored issues
–
show
|
|||
210 | |||
211 | header('Content-Type: text/xml; charset=' . $outputOptions['encoding']); |
||
212 | // header('Content-Length: ' . strlen($this->content)); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
54% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
213 | |||
214 | $this->sendContent(); |
||
215 | } |
||
216 | |||
217 | /** |
||
218 | * Clear all response data. |
||
219 | * |
||
220 | * @author David Zülke <[email protected]> |
||
221 | * @since 0.11.0 |
||
222 | */ |
||
223 | public function clear() |
||
224 | { |
||
225 | $this->clearContent(); |
||
226 | $this->httpHeaders = array(); |
||
0 ignored issues
–
show
The property
httpHeaders does not exist. Did you maybe forget to declare it?
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code: class MyClass { }
$x = new MyClass();
$x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: class MyClass {
public $foo;
}
$x = new MyClass();
$x->foo = true;
![]() |
|||
227 | $this->cookies = array(); |
||
0 ignored issues
–
show
The property
cookies does not exist. Did you maybe forget to declare it?
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code: class MyClass { }
$x = new MyClass();
$x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: class MyClass {
public $foo;
}
$x = new MyClass();
$x->foo = true;
![]() |
|||
228 | } |
||
229 | } |
||
230 |
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..