@@ -39,10 +39,10 @@ |
||
| 39 | 39 | $flags = ENT_COMPAT; |
| 40 | 40 | // avoid warnings on php < 5.4... |
| 41 | 41 | if (defined('ENT_HTML401')) { |
| 42 | - $flags = $flags | ENT_HTML401; |
|
| 42 | + $flags = $flags | ENT_HTML401; |
|
| 43 | 43 | } |
| 44 | 44 | if (defined('ENT_SUBSTITUTE')) { |
| 45 | - $flags = $flags | ENT_SUBSTITUTE; |
|
| 45 | + $flags = $flags | ENT_SUBSTITUTE; |
|
| 46 | 46 | } |
| 47 | 47 | if ($encoding != null) { |
| 48 | 48 | print "<PRE>\n".htmlentities($message, $flags, $encoding)."\n</PRE>"; |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | public function xml_header($charsetEncoding = '') |
| 39 | 39 | { |
| 40 | 40 | if ($charsetEncoding != '') { |
| 41 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n"; |
|
| 41 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n"; |
|
| 42 | 42 | } else { |
| 43 | - return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n"; |
|
| 43 | + return "<?xml version=\"1.0\"?".">\n<methodCall>\n"; |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |
@@ -52,16 +52,16 @@ discard block |
||
| 52 | 52 | public function createPayload($charsetEncoding = '') |
| 53 | 53 | { |
| 54 | 54 | if ($charsetEncoding != '') { |
| 55 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
| 55 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
| 56 | 56 | } else { |
| 57 | 57 | $this->content_type = 'text/xml'; |
| 58 | 58 | } |
| 59 | 59 | $this->payload = $this->xml_header($charsetEncoding); |
| 60 | - $this->payload .= '<methodName>' . Charset::instance()->encodeEntities( |
|
| 61 | - $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n"; |
|
| 60 | + $this->payload .= '<methodName>'.Charset::instance()->encodeEntities( |
|
| 61 | + $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n"; |
|
| 62 | 62 | $this->payload .= "<params>\n"; |
| 63 | 63 | foreach ($this->params as $p) { |
| 64 | - $this->payload .= "<param>\n" . $p->serialize($charsetEncoding) . |
|
| 64 | + $this->payload .= "<param>\n".$p->serialize($charsetEncoding). |
|
| 65 | 65 | "</param>\n"; |
| 66 | 66 | } |
| 67 | 67 | $this->payload .= "</params>\n"; |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array()); |
| 187 | 187 | |
| 188 | 188 | if ($data == '') { |
| 189 | - error_log('XML-RPC: ' . __METHOD__ . ': no response received from server.'); |
|
| 189 | + error_log('XML-RPC: '.__METHOD__.': no response received from server.'); |
|
| 190 | 190 | return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $httpParser = new Http(); |
| 196 | 196 | try { |
| 197 | 197 | $this->httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug); |
| 198 | - } catch(\Exception $e) { |
|
| 198 | + } catch (\Exception $e) { |
|
| 199 | 199 | $r = new Response(0, $e->getCode(), $e->getMessage()); |
| 200 | 200 | // failed processing of HTTP response headers |
| 201 | 201 | // save into response obj the full payload received, for debugging |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib |
| 215 | 215 | $pos = strrpos($data, '</methodResponse>'); |
| 216 | 216 | if ($pos !== false) { |
| 217 | - $data = substr($data, 0, $pos + 17); |
|
| 217 | + $data = substr($data, 0, $pos+17); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | // try to 'guestimate' the character encoding of the received response |
@@ -225,9 +225,9 @@ discard block |
||
| 225 | 225 | if ($start) { |
| 226 | 226 | $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
| 227 | 227 | $end = strpos($data, '-->', $start); |
| 228 | - $comments = substr($data, $start, $end - $start); |
|
| 229 | - Logger::instance()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t" . |
|
| 230 | - str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", $respEncoding); |
|
| 228 | + $comments = substr($data, $start, $end-$start); |
|
| 229 | + Logger::instance()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t". |
|
| 230 | + str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", $respEncoding); |
|
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | if (extension_loaded('mbstring')) { |
| 256 | 256 | $data = mb_convert_encoding($data, 'UTF-8', $respEncoding); |
| 257 | 257 | } else { |
| 258 | - error_log('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received response: ' . $respEncoding); |
|
| 258 | + error_log('XML-RPC: '.__METHOD__.': invalid charset encoding of received response: '.$respEncoding); |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | } |
@@ -275,12 +275,12 @@ discard block |
||
| 275 | 275 | $xmlRpcParser->parse($data, $returnType, XMLParser::ACCEPT_RESPONSE); |
| 276 | 276 | |
| 277 | 277 | // first error check: xml not well formed |
| 278 | - if ($xmlRpcParser->_xh['isf'] > 2) { |
|
| 278 | + if ($xmlRpcParser->_xh['isf']>2) { |
|
| 279 | 279 | |
| 280 | 280 | // BC break: in the past for some cases we used the error message: 'XML error at line 1, check URL' |
| 281 | 281 | |
| 282 | 282 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
| 283 | - PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
| 283 | + PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
| 284 | 284 | |
| 285 | 285 | if ($this->debug) { |
| 286 | 286 | print $xmlRpcParser->_xh['isf_reason']; |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
| 296 | - PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
| 296 | + PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
| 297 | 297 | } |
| 298 | 298 | // third error check: parsing of the response has somehow gone boink. |
| 299 | 299 | // NB: shall we omit this check, since we trust the parsing code? |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
| 305 | 305 | PhpXmlRpc::$xmlrpcstr['invalid_return']); |
| 306 | 306 | } else { |
| 307 | - if ($this->debug > 1) { |
|
| 307 | + if ($this->debug>1) { |
|
| 308 | 308 | Logger::instance()->debugMessage( |
| 309 | 309 | "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---" |
| 310 | 310 | ); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | return $xmlrpcVal->scalarval(); |
| 77 | 77 | case 'array': |
| 78 | 78 | $arr = array(); |
| 79 | - foreach($xmlrpcVal as $value) { |
|
| 79 | + foreach ($xmlrpcVal as $value) { |
|
| 80 | 80 | $arr[] = $this->decode($value, $options); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | case 'msg': |
| 107 | 107 | $paramCount = $xmlrpcVal->getNumParams(); |
| 108 | 108 | $arr = array(); |
| 109 | - for ($i = 0; $i < $paramCount; $i++) { |
|
| 109 | + for ($i = 0; $i<$paramCount; $i++) { |
|
| 110 | 110 | $arr[] = $this->decode($xmlrpcVal->getParam($i), $options); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $xmlrpcVal = new Value($phpVal->format('Ymd\TH:i:s'), Value::$xmlrpcStruct); |
| 185 | 185 | } else { |
| 186 | 186 | $arr = array(); |
| 187 | - foreach($phpVal as $k => $v) { |
|
| 187 | + foreach ($phpVal as $k => $v) { |
|
| 188 | 188 | $arr[$k] = $this->encode($v, $options); |
| 189 | 189 | } |
| 190 | 190 | $xmlrpcVal = new Value($arr, Value::$xmlrpcStruct); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | break; |
| 207 | 207 | case 'resource': |
| 208 | 208 | if (in_array('extension_api', $options)) { |
| 209 | - $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt); |
|
| 209 | + $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt); |
|
| 210 | 210 | } else { |
| 211 | 211 | $xmlrpcVal = new Value(); |
| 212 | 212 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | if (extension_loaded('mbstring')) { |
| 252 | 252 | $xmlVal = mb_convert_encoding($xmlVal, 'UTF-8', $valEncoding); |
| 253 | 253 | } else { |
| 254 | - error_log('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding); |
|
| 254 | + error_log('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding); |
|
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | } |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $xmlRpcParser = new XMLParser($options); |
| 268 | 268 | $xmlRpcParser->parse($xmlVal, XMLParser::RETURN_XMLRPCVALS, XMLParser::ACCEPT_REQUEST | XMLParser::ACCEPT_RESPONSE | XMLParser::ACCEPT_VALUE); |
| 269 | 269 | |
| 270 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
| 270 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
| 271 | 271 | // test that $xmlrpc->_xh['value'] is an obj, too??? |
| 272 | 272 | |
| 273 | 273 | error_log($xmlRpcParser->_xh['isf_reason']); |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | return $r; |
| 292 | 292 | case 'methodcall': |
| 293 | 293 | $req = new Request($xmlRpcParser->_xh['method']); |
| 294 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
| 294 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
| 295 | 295 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
| 296 | 296 | } |
| 297 | 297 | |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | protected $maxChunkLength = 4194304; |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | - * @param array $options passed to the xml parser |
|
| 78 | + * @param string[] $options passed to the xml parser |
|
| 79 | 79 | */ |
| 80 | 80 | public function __construct(array $options = array()) |
| 81 | 81 | { |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | $this->accept = $accept; |
| 134 | 134 | |
| 135 | 135 | // @see ticket #70 - we have to parse big xml docks in chunks to avoid errors |
| 136 | - for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) { |
|
| 136 | + for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) { |
|
| 137 | 137 | $chunk = substr($data, $offset, $this->maxChunkLength); |
| 138 | 138 | // error handling: xml not well formed |
| 139 | - if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) { |
|
| 139 | + if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) { |
|
| 140 | 140 | $errCode = xml_get_error_code($parser); |
| 141 | 141 | $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode), |
| 142 | 142 | xml_get_current_line_number($parser), xml_get_current_column_number($parser)); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false) |
| 161 | 161 | { |
| 162 | 162 | // if invalid xmlrpc already detected, skip all processing |
| 163 | - if ($this->_xh['isf'] < 2) { |
|
| 163 | + if ($this->_xh['isf']<2) { |
|
| 164 | 164 | |
| 165 | 165 | // check for correct element nesting |
| 166 | 166 | if (count($this->_xh['stack']) == 0) { |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | $this->_xh['rt'] = strtolower($name); |
| 180 | 180 | } else { |
| 181 | 181 | $this->_xh['isf'] = 2; |
| 182 | - $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name; |
|
| 182 | + $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name; |
|
| 183 | 183 | |
| 184 | 184 | return; |
| 185 | 185 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | break; |
| 274 | 274 | case 'MEMBER': |
| 275 | 275 | // set member name to null, in case we do not find in the xml later on |
| 276 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = ''; |
|
| 276 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = ''; |
|
| 277 | 277 | //$this->_xh['ac']=''; |
| 278 | 278 | // Drop trough intentionally |
| 279 | 279 | case 'PARAM': |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | */ |
| 334 | 334 | public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = true) |
| 335 | 335 | { |
| 336 | - if ($this->_xh['isf'] < 2) { |
|
| 336 | + if ($this->_xh['isf']<2) { |
|
| 337 | 337 | // push this element name from stack |
| 338 | 338 | // NB: if XML validates, correct opening/closing is guaranteed and |
| 339 | 339 | // we do not have to check for $name == $currElem. |
@@ -359,8 +359,8 @@ discard block |
||
| 359 | 359 | // check if we are inside an array or struct: |
| 360 | 360 | // if value just built is inside an array, let's move it into array on the stack |
| 361 | 361 | $vscount = count($this->_xh['valuestack']); |
| 362 | - if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') { |
|
| 363 | - $this->_xh['valuestack'][$vscount - 1]['values'][] = $temp; |
|
| 362 | + if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') { |
|
| 363 | + $this->_xh['valuestack'][$vscount-1]['values'][] = $temp; |
|
| 364 | 364 | } else { |
| 365 | 365 | $this->_xh['value'] = $temp; |
| 366 | 366 | } |
@@ -374,8 +374,8 @@ discard block |
||
| 374 | 374 | // check if we are inside an array or struct: |
| 375 | 375 | // if value just built is inside an array, let's move it into array on the stack |
| 376 | 376 | $vscount = count($this->_xh['valuestack']); |
| 377 | - if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') { |
|
| 378 | - $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value']; |
|
| 377 | + if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') { |
|
| 378 | + $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value']; |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | break; |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | $this->_xh['value'] = $this->_xh['ac']; |
| 396 | 396 | } elseif ($name == 'DATETIME.ISO8601') { |
| 397 | 397 | if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $this->_xh['ac'])) { |
| 398 | - error_log('XML-RPC: ' . __METHOD__ . ': invalid value received in DATETIME: ' . $this->_xh['ac']); |
|
| 398 | + error_log('XML-RPC: '.__METHOD__.': invalid value received in DATETIME: '.$this->_xh['ac']); |
|
| 399 | 399 | } |
| 400 | 400 | $this->_xh['vt'] = Value::$xmlrpcDateTime; |
| 401 | 401 | $this->_xh['value'] = $this->_xh['ac']; |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | } else { |
| 415 | 415 | // log if receiving something strange, even though we set the value to false anyway |
| 416 | 416 | if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') != 0) { |
| 417 | - error_log('XML-RPC: ' . __METHOD__ . ': invalid value received in BOOLEAN: ' . $this->_xh['ac']); |
|
| 417 | + error_log('XML-RPC: '.__METHOD__.': invalid value received in BOOLEAN: '.$this->_xh['ac']); |
|
| 418 | 418 | } |
| 419 | 419 | $this->_xh['value'] = false; |
| 420 | 420 | } |
@@ -424,37 +424,37 @@ discard block |
||
| 424 | 424 | // NOTE: regexp could be much stricter than this... |
| 425 | 425 | if (!preg_match('/^[+-eE0123456789 \t.]+$/', $this->_xh['ac'])) { |
| 426 | 426 | /// @todo: find a better way of throwing an error than this! |
| 427 | - error_log('XML-RPC: ' . __METHOD__ . ': non numeric value received in DOUBLE: ' . $this->_xh['ac']); |
|
| 427 | + error_log('XML-RPC: '.__METHOD__.': non numeric value received in DOUBLE: '.$this->_xh['ac']); |
|
| 428 | 428 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
| 429 | 429 | } else { |
| 430 | 430 | // it's ok, add it on |
| 431 | - $this->_xh['value'] = (double)$this->_xh['ac']; |
|
| 431 | + $this->_xh['value'] = (double) $this->_xh['ac']; |
|
| 432 | 432 | } |
| 433 | 433 | } else { |
| 434 | 434 | // we have an I4/I8/INT |
| 435 | 435 | // we must check that only 0123456789-<space> are characters here |
| 436 | 436 | if (!preg_match('/^[+-]?[0123456789 \t]+$/', $this->_xh['ac'])) { |
| 437 | 437 | /// @todo find a better way of throwing an error than this! |
| 438 | - error_log('XML-RPC: ' . __METHOD__ . ': non numeric value received in INT: ' . $this->_xh['ac']); |
|
| 438 | + error_log('XML-RPC: '.__METHOD__.': non numeric value received in INT: '.$this->_xh['ac']); |
|
| 439 | 439 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
| 440 | 440 | } else { |
| 441 | 441 | // it's ok, add it on |
| 442 | - $this->_xh['value'] = (int)$this->_xh['ac']; |
|
| 442 | + $this->_xh['value'] = (int) $this->_xh['ac']; |
|
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | 445 | $this->_xh['lv'] = 3; // indicate we've found a value |
| 446 | 446 | break; |
| 447 | 447 | case 'NAME': |
| 448 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac']; |
|
| 448 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac']; |
|
| 449 | 449 | break; |
| 450 | 450 | case 'MEMBER': |
| 451 | 451 | // add to array in the stack the last element built, |
| 452 | 452 | // unless no VALUE was found |
| 453 | 453 | if ($this->_xh['vt']) { |
| 454 | 454 | $vscount = count($this->_xh['valuestack']); |
| 455 | - $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value']; |
|
| 455 | + $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value']; |
|
| 456 | 456 | } else { |
| 457 | - error_log('XML-RPC: ' . __METHOD__ . ': missing VALUE inside STRUCT in received xml'); |
|
| 457 | + error_log('XML-RPC: '.__METHOD__.': missing VALUE inside STRUCT in received xml'); |
|
| 458 | 458 | } |
| 459 | 459 | break; |
| 460 | 460 | case 'DATA': |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | $this->_xh['params'][] = $this->_xh['value']; |
| 478 | 478 | $this->_xh['pt'][] = $this->_xh['vt']; |
| 479 | 479 | } else { |
| 480 | - error_log('XML-RPC: ' . __METHOD__ . ': missing VALUE inside PARAM in received xml'); |
|
| 480 | + error_log('XML-RPC: '.__METHOD__.': missing VALUE inside PARAM in received xml'); |
|
| 481 | 481 | } |
| 482 | 482 | break; |
| 483 | 483 | case 'METHODNAME': |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | public function xmlrpc_cd($parser, $data) |
| 524 | 524 | { |
| 525 | 525 | // skip processing if xml fault already detected |
| 526 | - if ($this->_xh['isf'] < 2) { |
|
| 526 | + if ($this->_xh['isf']<2) { |
|
| 527 | 527 | // "lookforvalue==3" means that we've found an entire value |
| 528 | 528 | // and should discard any further character data |
| 529 | 529 | if ($this->_xh['lv'] != 3) { |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | public function xmlrpc_dh($parser, $data) |
| 542 | 542 | { |
| 543 | 543 | // skip processing if xml fault already detected |
| 544 | - if ($this->_xh['isf'] < 2) { |
|
| 544 | + if ($this->_xh['isf']<2) { |
|
| 545 | 545 | if (substr($data, 0, 1) == '&' && substr($data, -1, 1) == ';') { |
| 546 | 546 | $this->_xh['ac'] .= $data; |
| 547 | 547 | } |
@@ -612,8 +612,8 @@ discard block |
||
| 612 | 612 | // Details: |
| 613 | 613 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
| 614 | 614 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
| 615 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
| 616 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 615 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
| 616 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 617 | 617 | $xmlChunk, $matches)) { |
| 618 | 618 | return strtoupper(substr($matches[2], 1, -1)); |
| 619 | 619 | } |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII... |
| 632 | 632 | // IANA also likes better US-ASCII, so go with it |
| 633 | 633 | if ($enc == 'ASCII') { |
| 634 | - $enc = 'US-' . $enc; |
|
| 634 | + $enc = 'US-'.$enc; |
|
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | return $enc; |
@@ -666,8 +666,8 @@ discard block |
||
| 666 | 666 | // Details: |
| 667 | 667 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
| 668 | 668 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
| 669 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
| 670 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 669 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
| 670 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 671 | 671 | $xmlChunk, $matches)) { |
| 672 | 672 | return true; |
| 673 | 673 | } |
@@ -117,35 +117,35 @@ |
||
| 117 | 117 | public function serialize($charsetEncoding = '') |
| 118 | 118 | { |
| 119 | 119 | if ($charsetEncoding != '') { |
| 120 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
| 120 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
| 121 | 121 | } else { |
| 122 | 122 | $this->content_type = 'text/xml'; |
| 123 | 123 | } |
| 124 | 124 | if (PhpXmlRpc::$xmlrpc_null_apache_encoding) { |
| 125 | - $result = "<methodResponse xmlns:ex=\"" . PhpXmlRpc::$xmlrpc_null_apache_encoding_ns . "\">\n"; |
|
| 125 | + $result = "<methodResponse xmlns:ex=\"".PhpXmlRpc::$xmlrpc_null_apache_encoding_ns."\">\n"; |
|
| 126 | 126 | } else { |
| 127 | 127 | $result = "<methodResponse>\n"; |
| 128 | 128 | } |
| 129 | 129 | if ($this->errno) { |
| 130 | 130 | // Let non-ASCII response messages be tolerated by clients by xml-encoding non ascii chars |
| 131 | - $result .= "<fault>\n" . |
|
| 132 | - "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno . |
|
| 133 | - "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" . |
|
| 134 | - Charset::instance()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</string></value>\n</member>\n" . |
|
| 131 | + $result .= "<fault>\n". |
|
| 132 | + "<value>\n<struct><member><name>faultCode</name>\n<value><int>".$this->errno. |
|
| 133 | + "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>". |
|
| 134 | + Charset::instance()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</string></value>\n</member>\n". |
|
| 135 | 135 | "</struct>\n</value>\n</fault>"; |
| 136 | 136 | } else { |
| 137 | 137 | if (!is_object($this->val) || !is_a($this->val, 'PhpXmlRpc\Value')) { |
| 138 | 138 | if (is_string($this->val) && $this->valtyp == 'xml') { |
| 139 | - $result .= "<params>\n<param>\n" . |
|
| 140 | - $this->val . |
|
| 139 | + $result .= "<params>\n<param>\n". |
|
| 140 | + $this->val. |
|
| 141 | 141 | "</param>\n</params>"; |
| 142 | 142 | } else { |
| 143 | 143 | /// @todo try to build something serializable? |
| 144 | 144 | throw new \Exception('cannot serialize xmlrpc response objects whose content is native php values'); |
| 145 | 145 | } |
| 146 | 146 | } else { |
| 147 | - $result .= "<params>\n<param>\n" . |
|
| 148 | - $this->val->serialize($charsetEncoding) . |
|
| 147 | + $result .= "<params>\n<param>\n". |
|
| 148 | + $this->val->serialize($charsetEncoding). |
|
| 149 | 149 | "</param>\n</params>"; |
| 150 | 150 | } |
| 151 | 151 | } |