@@ -183,12 +183,12 @@ discard block |
||
| 183 | 183 | // q: can php be built without ctype? should we use a regexp? |
| 184 | 184 | if (is_string($key) && !ctype_digit($key)) { |
| 185 | 185 | /// @todo on invalid options, throw/error-out instead of logging an error message? |
| 186 | - switch($key) { |
|
| 186 | + switch ($key) { |
|
| 187 | 187 | case 'target_charset': |
| 188 | 188 | if (function_exists('mb_convert_encoding')) { |
| 189 | 189 | $this->current_parsing_options['target_charset'] = $val; |
| 190 | 190 | } else { |
| 191 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": 'target_charset' option is unsupported without mbstring"); |
|
| 191 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.": 'target_charset' option is unsupported without mbstring"); |
|
| 192 | 192 | } |
| 193 | 193 | break; |
| 194 | 194 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | if (is_callable($val)) { |
| 197 | 197 | $this->current_parsing_options['methodname_callback'] = $val; |
| 198 | 198 | } else { |
| 199 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": Callback passed as 'methodname_callback' is not callable"); |
|
| 199 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.": Callback passed as 'methodname_callback' is not callable"); |
|
| 200 | 200 | } |
| 201 | 201 | break; |
| 202 | 202 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | break; |
| 208 | 208 | |
| 209 | 209 | default: |
| 210 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": unsupported option: $key"); |
|
| 210 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.": unsupported option: $key"); |
|
| 211 | 211 | } |
| 212 | 212 | unset($mergedOptions[$key]); |
| 213 | 213 | } |
@@ -253,10 +253,10 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | try { |
| 255 | 255 | // @see ticket #70 - we have to parse big xml docs in chunks to avoid errors |
| 256 | - for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) { |
|
| 256 | + for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) { |
|
| 257 | 257 | $chunk = substr($data, $offset, $this->maxChunkLength); |
| 258 | 258 | // error handling: xml not well formed |
| 259 | - if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) { |
|
| 259 | + if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) { |
|
| 260 | 260 | $errCode = xml_get_error_code($parser); |
| 261 | 261 | $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode), |
| 262 | 262 | xml_get_current_line_number($parser), xml_get_current_column_number($parser)); |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $this->_xh['isf_reason'] = $errStr; |
| 266 | 266 | } |
| 267 | 267 | // no need to parse further if we already have a fatal error |
| 268 | - if ($this->_xh['isf'] >= 2) { |
|
| 268 | + if ($this->_xh['isf']>=2) { |
|
| 269 | 269 | break; |
| 270 | 270 | } |
| 271 | 271 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false) |
| 304 | 304 | { |
| 305 | 305 | // if invalid xml-rpc already detected, skip all processing |
| 306 | - if ($this->_xh['isf'] >= 2) { |
|
| 306 | + if ($this->_xh['isf']>=2) { |
|
| 307 | 307 | return; |
| 308 | 308 | } |
| 309 | 309 | |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | $this->_xh['rt'] = strtolower($name); |
| 328 | 328 | } else { |
| 329 | 329 | $this->_xh['isf'] = 2; |
| 330 | - $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name; |
|
| 330 | + $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name; |
|
| 331 | 331 | |
| 332 | 332 | return; |
| 333 | 333 | } |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | |
| 430 | 430 | case 'MEMBER': |
| 431 | 431 | // set member name to null, in case we do not find in the xml later on |
| 432 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = null; |
|
| 432 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = null; |
|
| 433 | 433 | //$this->_xh['ac']=''; |
| 434 | 434 | // Drop trough intentionally |
| 435 | 435 | |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | */ |
| 510 | 510 | public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1) |
| 511 | 511 | { |
| 512 | - if ($this->_xh['isf'] >= 2) { |
|
| 512 | + if ($this->_xh['isf']>=2) { |
|
| 513 | 513 | return; |
| 514 | 514 | } |
| 515 | 515 | |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | $this->_xh['value'] = mb_convert_encoding($this->_xh['value'], $this->current_parsing_options['target_charset'], 'UTF-8'); |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | - if ($rebuildXmlrpcvals > 0) { |
|
| 534 | + if ($rebuildXmlrpcvals>0) { |
|
| 535 | 535 | // build the xml-rpc val out of the data received, and substitute it |
| 536 | 536 | $temp = new Value($this->_xh['value'], $this->_xh['vt']); |
| 537 | 537 | // in case we got info about underlying php class, save it in the object we're rebuilding |
@@ -539,15 +539,15 @@ discard block |
||
| 539 | 539 | $temp->_php_class = $this->_xh['php_class']; |
| 540 | 540 | } |
| 541 | 541 | $this->_xh['value'] = $temp; |
| 542 | - } elseif ($rebuildXmlrpcvals < 0) { |
|
| 542 | + } elseif ($rebuildXmlrpcvals<0) { |
|
| 543 | 543 | if ($this->_xh['vt'] == Value::$xmlrpcDateTime) { |
| 544 | - $this->_xh['value'] = (object)array( |
|
| 544 | + $this->_xh['value'] = (object) array( |
|
| 545 | 545 | 'xmlrpc_type' => 'datetime', |
| 546 | 546 | 'scalar' => $this->_xh['value'], |
| 547 | 547 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value']) |
| 548 | 548 | ); |
| 549 | 549 | } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) { |
| 550 | - $this->_xh['value'] = (object)array( |
|
| 550 | + $this->_xh['value'] = (object) array( |
|
| 551 | 551 | 'xmlrpc_type' => 'base64', |
| 552 | 552 | 'scalar' => $this->_xh['value'] |
| 553 | 553 | ); |
@@ -562,8 +562,8 @@ discard block |
||
| 562 | 562 | // check if we are inside an array or struct: |
| 563 | 563 | // if value just built is inside an array, let's move it into array on the stack |
| 564 | 564 | $vscount = count($this->_xh['valuestack']); |
| 565 | - if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') { |
|
| 566 | - $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value']; |
|
| 565 | + if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') { |
|
| 566 | + $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value']; |
|
| 567 | 567 | } |
| 568 | 568 | break; |
| 569 | 569 | |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | // log if receiving something strange, even though we set the value to false anyway |
| 591 | 591 | /// @todo to be consistent with the other types, we should return a value outside the good-value domain, e.g. NULL |
| 592 | 592 | if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') !== 0) { |
| 593 | - if (!$this->handleParsingError('invalid data received in BOOLEAN value: ' . |
|
| 593 | + if (!$this->handleParsingError('invalid data received in BOOLEAN value: '. |
|
| 594 | 594 | $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) { |
| 595 | 595 | return; |
| 596 | 596 | } |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | $this->_xh['vt'] = strtolower($name); |
| 611 | 611 | $this->_xh['lv'] = 3; // indicate we've found a value |
| 612 | 612 | if (!preg_match(PhpXmlRpc::$xmlrpc_int_format, $this->_xh['ac'])) { |
| 613 | - if (!$this->handleParsingError('non numeric data received in INT value: ' . |
|
| 613 | + if (!$this->handleParsingError('non numeric data received in INT value: '. |
|
| 614 | 614 | $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) { |
| 615 | 615 | return; |
| 616 | 616 | } |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
| 619 | 619 | } else { |
| 620 | 620 | // it's ok, add it on |
| 621 | - $this->_xh['value'] = (int)$this->_xh['ac']; |
|
| 621 | + $this->_xh['value'] = (int) $this->_xh['ac']; |
|
| 622 | 622 | } |
| 623 | 623 | break; |
| 624 | 624 | |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | $this->_xh['vt'] = Value::$xmlrpcDouble; |
| 627 | 627 | $this->_xh['lv'] = 3; // indicate we've found a value |
| 628 | 628 | if (!preg_match(PhpXmlRpc::$xmlrpc_double_format, $this->_xh['ac'])) { |
| 629 | - if (!$this->handleParsingError('non numeric data received in DOUBLE value: ' . |
|
| 629 | + if (!$this->handleParsingError('non numeric data received in DOUBLE value: '. |
|
| 630 | 630 | $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) { |
| 631 | 631 | return; |
| 632 | 632 | } |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
| 635 | 635 | } else { |
| 636 | 636 | // it's ok, add it on |
| 637 | - $this->_xh['value'] = (double)$this->_xh['ac']; |
|
| 637 | + $this->_xh['value'] = (double) $this->_xh['ac']; |
|
| 638 | 638 | } |
| 639 | 639 | break; |
| 640 | 640 | |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | $this->_xh['vt'] = Value::$xmlrpcDateTime; |
| 643 | 643 | $this->_xh['lv'] = 3; // indicate we've found a value |
| 644 | 644 | if (!preg_match(PhpXmlRpc::$xmlrpc_datetime_format, $this->_xh['ac'])) { |
| 645 | - if (!$this->handleParsingError('invalid data received in DATETIME value: ' . |
|
| 645 | + if (!$this->handleParsingError('invalid data received in DATETIME value: '. |
|
| 646 | 646 | $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) { |
| 647 | 647 | return; |
| 648 | 648 | } |
@@ -653,9 +653,9 @@ discard block |
||
| 653 | 653 | |
| 654 | 654 | // the default regex used to validate the date string a few lines above should make this case impossible, |
| 655 | 655 | // but one never knows... |
| 656 | - } catch(\Exception $e) { |
|
| 656 | + } catch (\Exception $e) { |
|
| 657 | 657 | // what to do? We can not guarantee that a valid date can be created. We return null... |
| 658 | - if (!$this->handleParsingError('invalid data received in DATETIME value. Error ' . |
|
| 658 | + if (!$this->handleParsingError('invalid data received in DATETIME value. Error '. |
|
| 659 | 659 | $e->getMessage(), __METHOD__)) { |
| 660 | 660 | return; |
| 661 | 661 | } |
@@ -672,14 +672,14 @@ discard block |
||
| 672 | 672 | $v = base64_decode($this->_xh['ac'], true); |
| 673 | 673 | if ($v === false) { |
| 674 | 674 | $this->_xh['isf'] = 2; |
| 675 | - $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '. $this->truncateValueForLog($this->_xh['ac']); |
|
| 675 | + $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '.$this->truncateValueForLog($this->_xh['ac']); |
|
| 676 | 676 | return; |
| 677 | 677 | } |
| 678 | 678 | } else { |
| 679 | 679 | $v = base64_decode($this->_xh['ac']); |
| 680 | 680 | if ($v === '' && $this->_xh['ac'] !== '') { |
| 681 | 681 | // only the empty string should decode to the empty string |
| 682 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value: ' . |
|
| 682 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value: '. |
|
| 683 | 683 | $this->truncateValueForLog($this->_xh['ac'])); |
| 684 | 684 | } |
| 685 | 685 | } |
@@ -687,20 +687,20 @@ discard block |
||
| 687 | 687 | break; |
| 688 | 688 | |
| 689 | 689 | case 'NAME': |
| 690 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac']; |
|
| 690 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac']; |
|
| 691 | 691 | break; |
| 692 | 692 | |
| 693 | 693 | case 'MEMBER': |
| 694 | 694 | // add to array in the stack the last element built, unless no VALUE or no NAME were found |
| 695 | 695 | if ($this->_xh['vt']) { |
| 696 | 696 | $vscount = count($this->_xh['valuestack']); |
| 697 | - if ($this->_xh['valuestack'][$vscount - 1]['name'] === null) { |
|
| 697 | + if ($this->_xh['valuestack'][$vscount-1]['name'] === null) { |
|
| 698 | 698 | if (!$this->handleParsingError('missing NAME inside STRUCT in received xml', __METHOD__)) { |
| 699 | 699 | return; |
| 700 | 700 | } |
| 701 | - $this->_xh['valuestack'][$vscount - 1]['name'] = ''; |
|
| 701 | + $this->_xh['valuestack'][$vscount-1]['name'] = ''; |
|
| 702 | 702 | } |
| 703 | - $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value']; |
|
| 703 | + $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value']; |
|
| 704 | 704 | } else { |
| 705 | 705 | if (!$this->handleParsingError('missing VALUE inside STRUCT in received xml', __METHOD__)) { |
| 706 | 706 | return; |
@@ -816,7 +816,7 @@ discard block |
||
| 816 | 816 | public function xmlrpc_cd($parser, $data) |
| 817 | 817 | { |
| 818 | 818 | // skip processing if xml fault already detected |
| 819 | - if ($this->_xh['isf'] >= 2) { |
|
| 819 | + if ($this->_xh['isf']>=2) { |
|
| 820 | 820 | return; |
| 821 | 821 | } |
| 822 | 822 | |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | public function xmlrpc_dh($parser, $data) |
| 839 | 839 | { |
| 840 | 840 | // skip processing if xml fault already detected |
| 841 | - if ($this->_xh['isf'] >= 2) { |
|
| 841 | + if ($this->_xh['isf']>=2) { |
|
| 842 | 842 | return; |
| 843 | 843 | } |
| 844 | 844 | |
@@ -912,8 +912,8 @@ discard block |
||
| 912 | 912 | // Details: |
| 913 | 913 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
| 914 | 914 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
| 915 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
| 916 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 915 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
| 916 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 917 | 917 | $xmlChunk, $matches)) { |
| 918 | 918 | return strtoupper(substr($matches[2], 1, -1)); |
| 919 | 919 | } |
@@ -931,7 +931,7 @@ discard block |
||
| 931 | 931 | // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII... |
| 932 | 932 | // IANA also likes better US-ASCII, so go with it |
| 933 | 933 | if ($enc == 'ASCII') { |
| 934 | - $enc = 'US-' . $enc; |
|
| 934 | + $enc = 'US-'.$enc; |
|
| 935 | 935 | } |
| 936 | 936 | |
| 937 | 937 | return $enc; |
@@ -968,8 +968,8 @@ discard block |
||
| 968 | 968 | // Details: |
| 969 | 969 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
| 970 | 970 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
| 971 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
| 972 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 971 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
| 972 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 973 | 973 | $xmlChunk)) { |
| 974 | 974 | return true; |
| 975 | 975 | } |
@@ -989,7 +989,7 @@ discard block |
||
| 989 | 989 | $this->_xh['isf_reason'] = ucfirst($message); |
| 990 | 990 | return false; |
| 991 | 991 | } else { |
| 992 | - $this->getLogger()->error('XML-RPC: ' . ($method != '' ? $method . ': ' : '') . $message); |
|
| 992 | + $this->getLogger()->error('XML-RPC: '.($method != '' ? $method.': ' : '').$message); |
|
| 993 | 993 | return true; |
| 994 | 994 | } |
| 995 | 995 | } |
@@ -1001,8 +1001,8 @@ discard block |
||
| 1001 | 1001 | */ |
| 1002 | 1002 | protected function truncateValueForLog($data) |
| 1003 | 1003 | { |
| 1004 | - if (strlen($data) > $this->maxLogValueLength) { |
|
| 1005 | - return substr($data, 0, $this->maxLogValueLength - 3) . '...'; |
|
| 1004 | + if (strlen($data)>$this->maxLogValueLength) { |
|
| 1005 | + return substr($data, 0, $this->maxLogValueLength-3).'...'; |
|
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | 1008 | return $data; |
@@ -1021,7 +1021,7 @@ discard block |
||
| 1021 | 1021 | break; |
| 1022 | 1022 | default: |
| 1023 | 1023 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
| 1024 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 1024 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 1025 | 1025 | } |
| 1026 | 1026 | } |
| 1027 | 1027 | |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | break; |
| 1047 | 1047 | default: |
| 1048 | 1048 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
| 1049 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 1049 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 1050 | 1050 | } |
| 1051 | 1051 | } |
| 1052 | 1052 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving Requests and Responses, except for the parsing part |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving automatic encoding/decoding of php values into xmlrpc values (the Encoder class). |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | /// @todo it seems that old php versions can not automatically transform latin to utf8 upon xml parsing. |
| 76 | 76 | /// We should fix that, then re-enable this test |
| 77 | 77 | if (version_compare(PHP_VERSION, '5.6.0', '>=')) { |
| 78 | - $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>' . $string . '</string></value>'); |
|
| 78 | + $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>'.$string.'</string></value>'); |
|
| 79 | 79 | $this->assertEquals($string, $i->scalarVal()); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
| 4 | -include_once __DIR__ . '/../lib/xmlrpcs.inc'; |
|
| 3 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
| 4 | +include_once __DIR__.'/../lib/xmlrpcs.inc'; |
|
| 5 | 5 | |
| 6 | -include_once __DIR__ . '/parse_args.php'; |
|
| 6 | +include_once __DIR__.'/parse_args.php'; |
|
| 7 | 7 | |
| 8 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
| 8 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
| 9 | 9 | |
| 10 | 10 | use PHPUnit\Runner\BaseTestRunner; |
| 11 | 11 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | protected function tear_down() |
| 34 | 34 | { |
| 35 | - if ($this->args['DEBUG'] > 0) { |
|
| 35 | + if ($this->args['DEBUG']>0) { |
|
| 36 | 36 | return; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | public function debug($message, $context = array()) |
| 52 | 52 | { |
| 53 | - $this->buffer .= $message . "\n"; |
|
| 53 | + $this->buffer .= $message."\n"; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public function error($message, $context = array()) |
| 57 | 57 | { |
| 58 | - $this->buffer .= $message . "\n"; |
|
| 58 | + $this->buffer .= $message."\n"; |
|
| 59 | 59 | } |
| 60 | 60 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving the Client class (and no server). |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $this->client->server .= 'XXX'; |
| 36 | 36 | $dnsinfo = @dns_get_record($this->client->server); |
| 37 | 37 | if ($dnsinfo) { |
| 38 | - $this->markTestSkipped('Seems like there is a catchall DNS in effect: host ' . $this->client->server . ' found'); |
|
| 38 | + $this->markTestSkipped('Seems like there is a catchall DNS in effect: host '.$this->client->server.' found'); |
|
| 39 | 39 | } else { |
| 40 | 40 | $r = $this->client->send($m, 5); |
| 41 | 41 | // make sure there's no freaking catchall DNS in effect |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | // now test a successful connection |
| 64 | 64 | $server = explode(':', $this->args['HTTPSERVER']); |
| 65 | - if (count($server) > 1) { |
|
| 65 | + if (count($server)>1) { |
|
| 66 | 66 | $this->client->port = $server[1]; |
| 67 | 67 | } |
| 68 | 68 | $this->client->server = $server[0]; |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving the Value class. |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $this->assertequals(1, count($v1)); |
| 156 | 156 | $out = array('me' => array(), 'mytype' => 2, '_php_class' => null); |
| 157 | 157 | |
| 158 | - foreach($v1 as $key => $val) |
|
| 158 | + foreach ($v1 as $key => $val) |
|
| 159 | 159 | { |
| 160 | 160 | $this->assertArrayHasKey($key, $out); |
| 161 | 161 | $expected = $out[$key]; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $this->assertequals(2, count($v2)); |
| 171 | 171 | $out = array(array('key' => 0, 'value' => 'object'), array('key' => 1, 'value' => 'object')); |
| 172 | 172 | $i = 0; |
| 173 | - foreach($v2 as $key => $val) |
|
| 173 | + foreach ($v2 as $key => $val) |
|
| 174 | 174 | { |
| 175 | 175 | $expected = $out[$i]; |
| 176 | 176 | $this->assertequals($expected['key'], $key); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | { |
| 185 | 185 | // nb: make sure that the serialized xml corresponding to this is > 10MB in size |
| 186 | 186 | $data = array(); |
| 187 | - for ($i = 0; $i < 500000; $i++ ) { |
|
| 187 | + for ($i = 0; $i<500000; $i++) { |
|
| 188 | 188 | $data[] = 'hello world'; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving xml parsing. |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | public function testI8() |
| 103 | 103 | { |
| 104 | - if (PHP_INT_SIZE == 4 ) { |
|
| 104 | + if (PHP_INT_SIZE == 4) { |
|
| 105 | 105 | $this->markTestSkipped('Can not test i8 as php is compiled in 32 bit mode'); |
| 106 | 106 | return; |
| 107 | 107 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | public function testUnicodeInMemberName() |
| 178 | 178 | { |
| 179 | - $str = "G" . chr(252) . "nter, El" . chr(232) . "ne"; |
|
| 179 | + $str = "G".chr(252)."nter, El".chr(232)."ne"; |
|
| 180 | 180 | $v = array($str => new xmlrpcval(1)); |
| 181 | 181 | $r = new xmlrpcresp(new xmlrpcval($v, 'struct')); |
| 182 | 182 | $r = $r->serialize(); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $response = @utf8_encode( |
| 193 | 193 | '<?xml version="1.0"?> |
| 194 | 194 | <!-- covers what happens when lib receives UTF8 chars in response text and comments --> |
| 195 | -<!-- ' . chr(224) . chr(252) . chr(232) . 'àüè --> |
|
| 195 | +<!-- ' . chr(224).chr(252).chr(232).'àüè --> |
|
| 196 | 196 | <methodResponse> |
| 197 | 197 | <fault> |
| 198 | 198 | <value> |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | </member> |
| 204 | 204 | <member> |
| 205 | 205 | <name>faultString</name> |
| 206 | -<value><string>' . chr(224) . chr(252) . chr(232) . 'àüè</string></value> |
|
| 206 | +<value><string>' . chr(224).chr(252).chr(232).'àüè</string></value> |
|
| 207 | 207 | </member> |
| 208 | 208 | </struct> |
| 209 | 209 | </value> |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $m = $this->newRequest('dummy'); |
| 213 | 213 | $r = $m->parseResponse($response); |
| 214 | 214 | $v = $r->faultString(); |
| 215 | - $this->assertEquals(chr(224) . chr(252) . chr(232) . chr(224) . chr(252) . chr(232), $v); |
|
| 215 | + $this->assertEquals(chr(224).chr(252).chr(232).chr(224).chr(252).chr(232), $v); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | public function testBrokenRequests() |
@@ -419,8 +419,8 @@ discard block |
||
| 419 | 419 | $i = \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values; |
| 420 | 420 | \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values = true; |
| 421 | 421 | |
| 422 | - foreach($values as $value) { |
|
| 423 | - $f = '<?xml version="1.0"?><methodResponse><params><param><value>' . $value . '</value></param></params></methodResponse> '; |
|
| 422 | + foreach ($values as $value) { |
|
| 423 | + $f = '<?xml version="1.0"?><methodResponse><params><param><value>'.$value.'</value></param></params></methodResponse> '; |
|
| 424 | 424 | $r = $s->parseResponse($f); |
| 425 | 425 | $v = $r->faultCode(); |
| 426 | 426 | $this->assertEquals(2, $v, "Testing $value"); |
@@ -524,11 +524,11 @@ discard block |
||
| 524 | 524 | |
| 525 | 525 | public function testUTF8Response() |
| 526 | 526 | { |
| 527 | - $string = chr(224) . chr(252) . chr(232); |
|
| 527 | + $string = chr(224).chr(252).chr(232); |
|
| 528 | 528 | |
| 529 | 529 | $s = $this->newRequest('dummy'); |
| 530 | - $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
| 531 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 530 | + $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
| 531 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 532 | 532 | '; |
| 533 | 533 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 534 | 534 | $v = $r->value(); |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | $this->assertEquals($string, $v); |
| 537 | 537 | |
| 538 | 538 | $f = '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
| 539 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 539 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 540 | 540 | '; |
| 541 | 541 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 542 | 542 | $v = $r->value(); |
@@ -552,11 +552,11 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | public function testLatin1Response() |
| 554 | 554 | { |
| 555 | - $string = chr(224) . chr(252) . chr(232); |
|
| 555 | + $string = chr(224).chr(252).chr(232); |
|
| 556 | 556 | |
| 557 | 557 | $s = $this->newRequest('dummy'); |
| 558 | - $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
| 559 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 558 | + $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
| 559 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 560 | 560 | '; |
| 561 | 561 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 562 | 562 | $v = $r->value(); |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | $this->assertEquals($string, $v); |
| 565 | 565 | |
| 566 | 566 | $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
| 567 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 567 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 568 | 568 | '; |
| 569 | 569 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 570 | 570 | $v = $r->value(); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage; |
| 6 | 6 | use PHPUnit\Framework\TestResult; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function _run($result = NULL) |
| 30 | 30 | { |
| 31 | - $this->testId = get_class($this) . '__' . $this->getName(); |
|
| 31 | + $this->testId = get_class($this).'__'.$this->getName(); |
|
| 32 | 32 | |
| 33 | 33 | if ($result === NULL) { |
| 34 | 34 | $result = $this->createResult(); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | parent::set_up(); |
| 60 | 60 | |
| 61 | 61 | // assumes HTTPURI to be in the form /tests/index.php?etc... |
| 62 | - $this->baseUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
| 63 | - $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
| 62 | + $this->baseUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
| 63 | + $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
| 64 | 64 | } |
| 65 | 65 | } |
@@ -57,13 +57,13 @@ discard block |
||
| 57 | 57 | 'scalar' => $val, |
| 58 | 58 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($val) |
| 59 | 59 | ); |
| 60 | - return (object)$xmlrpcVal; |
|
| 60 | + return (object) $xmlrpcVal; |
|
| 61 | 61 | case 'base64': |
| 62 | 62 | $xmlrpcVal = array( |
| 63 | 63 | 'xmlrpc_type' => 'base64', |
| 64 | 64 | 'scalar' => $val |
| 65 | 65 | ); |
| 66 | - return (object)$xmlrpcVal; |
|
| 66 | + return (object) $xmlrpcVal; |
|
| 67 | 67 | case 'string': |
| 68 | 68 | if (isset($options['extension_api_encoding'])) { |
| 69 | 69 | // if iconv is not available, we use mb_convert_encoding |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | case 'msg': |
| 137 | 137 | $paramCount = $xmlrpcVal->getNumParams(); |
| 138 | 138 | $arr = array(); |
| 139 | - for ($i = 0; $i < $paramCount; $i++) { |
|
| 139 | + for ($i = 0; $i<$paramCount; $i++) { |
|
| 140 | 140 | $arr[] = $this->decode($xmlrpcVal->getParam($i), $options); |
| 141 | 141 | } |
| 142 | 142 | return $arr; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | break; |
| 262 | 262 | case 'resource': |
| 263 | 263 | if (in_array('extension_api', $options)) { |
| 264 | - $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt); |
|
| 264 | + $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt); |
|
| 265 | 265 | } else { |
| 266 | 266 | $xmlrpcVal = new Value(); |
| 267 | 267 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | if (function_exists('mb_convert_encoding')) { |
| 308 | 308 | $xmlVal = mb_convert_encoding($xmlVal, 'UTF-8', $valEncoding); |
| 309 | 309 | } else { |
| 310 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding); |
|
| 310 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding); |
|
| 311 | 311 | } |
| 312 | 312 | } |
| 313 | 313 | } |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | $parserOptions |
| 329 | 329 | ); |
| 330 | 330 | |
| 331 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
| 331 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
| 332 | 332 | // test that $xmlrpc->_xh['value'] is an obj, too??? |
| 333 | 333 | |
| 334 | 334 | $this->getLogger()->error($xmlRpcParser->_xh['isf_reason']); |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | case 'methodcall': |
| 354 | 354 | $req = new Request($xmlRpcParser->_xh['method']); |
| 355 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
| 355 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
| 356 | 356 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
| 357 | 357 | } |
| 358 | 358 | return $req; |