@@ -175,12 +175,12 @@ discard block |
||
175 | 175 | foreach ($mergedOptions as $key => $val) { |
176 | 176 | // q: can php be built without ctype? should we use a regexp? |
177 | 177 | if (is_string($key) && !ctype_digit($key)) { |
178 | - switch($key) { |
|
178 | + switch ($key) { |
|
179 | 179 | case 'target_charset': |
180 | 180 | if (function_exists('mb_convert_encoding')) { |
181 | 181 | $this->current_parsing_options['target_charset'] = $val; |
182 | 182 | } else { |
183 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": 'target_charset' option is unsupported without mbstring"); |
|
183 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": 'target_charset' option is unsupported without mbstring"); |
|
184 | 184 | } |
185 | 185 | break; |
186 | 186 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | //$this->_xh['isf'] = 4; |
192 | 192 | //$this->_xh['isf_reason'] = "Callback passed as 'methodname_callback' is not callable"; |
193 | 193 | //return; |
194 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": Callback passed as 'methodname_callback' is not callable"); |
|
194 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": Callback passed as 'methodname_callback' is not callable"); |
|
195 | 195 | } |
196 | 196 | break; |
197 | 197 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | break; |
202 | 202 | |
203 | 203 | default: |
204 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": unsupported option: $key"); |
|
204 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": unsupported option: $key"); |
|
205 | 205 | } |
206 | 206 | unset($mergedOptions[$key]); |
207 | 207 | } |
@@ -244,10 +244,10 @@ discard block |
||
244 | 244 | |
245 | 245 | try { |
246 | 246 | // @see ticket #70 - we have to parse big xml docs in chunks to avoid errors |
247 | - for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) { |
|
247 | + for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) { |
|
248 | 248 | $chunk = substr($data, $offset, $this->maxChunkLength); |
249 | 249 | // error handling: xml not well formed |
250 | - if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) { |
|
250 | + if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) { |
|
251 | 251 | $errCode = xml_get_error_code($parser); |
252 | 252 | $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode), |
253 | 253 | xml_get_current_line_number($parser), xml_get_current_column_number($parser)); |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | break; |
258 | 258 | } |
259 | 259 | // no need to parse further if we already have a fatal error |
260 | - if ($this->_xh['isf'] >= 2) { |
|
260 | + if ($this->_xh['isf']>=2) { |
|
261 | 261 | break; |
262 | 262 | } |
263 | 263 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false) |
290 | 290 | { |
291 | 291 | // if invalid xml-rpc already detected, skip all processing |
292 | - if ($this->_xh['isf'] >= 2) { |
|
292 | + if ($this->_xh['isf']>=2) { |
|
293 | 293 | return; |
294 | 294 | } |
295 | 295 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | $this->_xh['rt'] = strtolower($name); |
313 | 313 | } else { |
314 | 314 | $this->_xh['isf'] = 2; |
315 | - $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name; |
|
315 | + $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name; |
|
316 | 316 | |
317 | 317 | return; |
318 | 318 | } |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | |
415 | 415 | case 'MEMBER': |
416 | 416 | // set member name to null, in case we do not find in the xml later on |
417 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = ''; |
|
417 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = ''; |
|
418 | 418 | //$this->_xh['ac']=''; |
419 | 419 | // Drop trough intentionally |
420 | 420 | |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | */ |
487 | 487 | public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1) |
488 | 488 | { |
489 | - if ($this->_xh['isf'] >= 2) { |
|
489 | + if ($this->_xh['isf']>=2) { |
|
490 | 490 | return; |
491 | 491 | |
492 | 492 | } |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | $this->_xh['value'] = mb_convert_encoding($this->_xh['value'], $this->current_parsing_options['target_charset'], 'UTF-8'); |
509 | 509 | } |
510 | 510 | |
511 | - if ($rebuildXmlrpcvals > 0) { |
|
511 | + if ($rebuildXmlrpcvals>0) { |
|
512 | 512 | // build the xml-rpc val out of the data received, and substitute it |
513 | 513 | $temp = new Value($this->_xh['value'], $this->_xh['vt']); |
514 | 514 | // in case we got info about underlying php class, save it in the object we're rebuilding |
@@ -516,15 +516,15 @@ discard block |
||
516 | 516 | $temp->_php_class = $this->_xh['php_class']; |
517 | 517 | } |
518 | 518 | $this->_xh['value'] = $temp; |
519 | - } elseif ($rebuildXmlrpcvals < 0) { |
|
519 | + } elseif ($rebuildXmlrpcvals<0) { |
|
520 | 520 | if ($this->_xh['vt'] == Value::$xmlrpcDateTime) { |
521 | - $this->_xh['value'] = (object)array( |
|
521 | + $this->_xh['value'] = (object) array( |
|
522 | 522 | 'xmlrpc_type' => 'datetime', |
523 | 523 | 'scalar' => $this->_xh['value'], |
524 | 524 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value']) |
525 | 525 | ); |
526 | 526 | } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) { |
527 | - $this->_xh['value'] = (object)array( |
|
527 | + $this->_xh['value'] = (object) array( |
|
528 | 528 | 'xmlrpc_type' => 'base64', |
529 | 529 | 'scalar' => $this->_xh['value'] |
530 | 530 | ); |
@@ -539,8 +539,8 @@ discard block |
||
539 | 539 | // check if we are inside an array or struct: |
540 | 540 | // if value just built is inside an array, let's move it into array on the stack |
541 | 541 | $vscount = count($this->_xh['valuestack']); |
542 | - if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') { |
|
543 | - $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value']; |
|
542 | + if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') { |
|
543 | + $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value']; |
|
544 | 544 | } |
545 | 545 | break; |
546 | 546 | |
@@ -560,11 +560,11 @@ discard block |
||
560 | 560 | $this->_xh['value'] = $this->_xh['ac']; |
561 | 561 | } elseif ($name == 'DATETIME.ISO8601') { |
562 | 562 | if (!preg_match(PhpXmlRpc::$xmlrpc_datetime_format, $this->_xh['ac'])) { |
563 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid value received in DATETIME: ' . $this->_xh['ac']); |
|
563 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid value received in DATETIME: '.$this->_xh['ac']); |
|
564 | 564 | } |
565 | 565 | $this->_xh['vt'] = Value::$xmlrpcDateTime; |
566 | 566 | if ($this->current_parsing_options['xmlrpc_return_datetimes']) { |
567 | - $this->_xh['value'] = new \DateTime($this->_xh['ac']); |
|
567 | + $this->_xh['value'] = new \DateTime($this->_xh['ac']); |
|
568 | 568 | } else { |
569 | 569 | $this->_xh['value'] = $this->_xh['ac']; |
570 | 570 | } |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | } else { |
582 | 582 | // log if receiving something strange, even though we set the value to false anyway |
583 | 583 | if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') != 0) { |
584 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid value received in BOOLEAN: ' . $this->_xh['ac']); |
|
584 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid value received in BOOLEAN: '.$this->_xh['ac']); |
|
585 | 585 | } |
586 | 586 | $this->_xh['value'] = false; |
587 | 587 | } |
@@ -591,38 +591,38 @@ discard block |
||
591 | 591 | // NOTE: regexp could be much stricter than this... |
592 | 592 | if (!preg_match('/^[+-eE0123456789 \t.]+$/', $this->_xh['ac'])) { |
593 | 593 | /// @todo: find a better way of throwing an error than this! |
594 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric value received in DOUBLE: ' . $this->_xh['ac']); |
|
594 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric value received in DOUBLE: '.$this->_xh['ac']); |
|
595 | 595 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
596 | 596 | } else { |
597 | 597 | // it's ok, add it on |
598 | - $this->_xh['value'] = (double)$this->_xh['ac']; |
|
598 | + $this->_xh['value'] = (double) $this->_xh['ac']; |
|
599 | 599 | } |
600 | 600 | } else { |
601 | 601 | // we have an I4/I8/INT |
602 | 602 | // we must check that only 0123456789-<space> are characters here |
603 | 603 | if (!preg_match('/^[+-]?[0123456789 \t]+$/', $this->_xh['ac'])) { |
604 | 604 | /// @todo find a better way of throwing an error than this! |
605 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric value received in INT: ' . $this->_xh['ac']); |
|
605 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric value received in INT: '.$this->_xh['ac']); |
|
606 | 606 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
607 | 607 | } else { |
608 | 608 | // it's ok, add it on |
609 | - $this->_xh['value'] = (int)$this->_xh['ac']; |
|
609 | + $this->_xh['value'] = (int) $this->_xh['ac']; |
|
610 | 610 | } |
611 | 611 | } |
612 | 612 | $this->_xh['lv'] = 3; // indicate we've found a value |
613 | 613 | break; |
614 | 614 | |
615 | 615 | case 'NAME': |
616 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac']; |
|
616 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac']; |
|
617 | 617 | break; |
618 | 618 | |
619 | 619 | case 'MEMBER': |
620 | 620 | // add to array in the stack the last element built, unless no VALUE was found |
621 | 621 | if ($this->_xh['vt']) { |
622 | 622 | $vscount = count($this->_xh['valuestack']); |
623 | - $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value']; |
|
623 | + $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value']; |
|
624 | 624 | } else { |
625 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside STRUCT in received xml'); |
|
625 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside STRUCT in received xml'); |
|
626 | 626 | } |
627 | 627 | break; |
628 | 628 | |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | $this->_xh['params'][] = $this->_xh['value']; |
648 | 648 | $this->_xh['pt'][] = $this->_xh['vt']; |
649 | 649 | } else { |
650 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside PARAM in received xml'); |
|
650 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside PARAM in received xml'); |
|
651 | 651 | } |
652 | 652 | break; |
653 | 653 | |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | public function xmlrpc_cd($parser, $data) |
723 | 723 | { |
724 | 724 | // skip processing if xml fault already detected |
725 | - if ($this->_xh['isf'] >= 2) { |
|
725 | + if ($this->_xh['isf']>=2) { |
|
726 | 726 | return; |
727 | 727 | } |
728 | 728 | |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | public function xmlrpc_dh($parser, $data) |
745 | 745 | { |
746 | 746 | // skip processing if xml fault already detected |
747 | - if ($this->_xh['isf'] >= 2) { |
|
747 | + if ($this->_xh['isf']>=2) { |
|
748 | 748 | return; |
749 | 749 | } |
750 | 750 | |
@@ -818,8 +818,8 @@ discard block |
||
818 | 818 | // Details: |
819 | 819 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
820 | 820 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
821 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
822 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
821 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
822 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
823 | 823 | $xmlChunk, $matches)) { |
824 | 824 | return strtoupper(substr($matches[2], 1, -1)); |
825 | 825 | } |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII... |
838 | 838 | // IANA also likes better US-ASCII, so go with it |
839 | 839 | if ($enc == 'ASCII') { |
840 | - $enc = 'US-' . $enc; |
|
840 | + $enc = 'US-'.$enc; |
|
841 | 841 | } |
842 | 842 | |
843 | 843 | return $enc; |
@@ -874,8 +874,8 @@ discard block |
||
874 | 874 | // Details: |
875 | 875 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
876 | 876 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
877 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
878 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
877 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
878 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
879 | 879 | $xmlChunk)) { |
880 | 880 | return true; |
881 | 881 | } |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | break; |
896 | 896 | default: |
897 | 897 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
898 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
898 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
899 | 899 | } |
900 | 900 | } |
901 | 901 | |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | break; |
920 | 920 | default: |
921 | 921 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
922 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
922 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
923 | 923 | } |
924 | 924 | } |
925 | 925 | } |