@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . "/_prepend.php"; |
|
| 2 | +require_once __DIR__."/_prepend.php"; |
|
| 3 | 3 | |
| 4 | 4 | require_once __DIR__.'/methodProviders/CommentManager.php'; |
| 5 | 5 | |
@@ -25,33 +25,33 @@ discard block |
||
| 25 | 25 | // generate a file with a class definition |
| 26 | 26 | |
| 27 | 27 | // the generated code does not have an autoloader included - we need to add in one |
| 28 | -$autoloader = __DIR__ . "/_prepend.php"; |
|
| 28 | +$autoloader = __DIR__."/_prepend.php"; |
|
| 29 | 29 | |
| 30 | 30 | file_put_contents($targetClassFile, |
| 31 | - "<?php\n\n" . |
|
| 32 | - "require_once '$autoloader';\n\n" . |
|
| 31 | + "<?php\n\n". |
|
| 32 | + "require_once '$autoloader';\n\n". |
|
| 33 | 33 | "class MyServerClass\n{\n\n" |
| 34 | 34 | ) || die('uh oh'); |
| 35 | 35 | |
| 36 | 36 | // we mangle a bit the code we get from wrapPhpClass to generate a php class instead of a bunch of functions |
| 37 | 37 | |
| 38 | -foreach($code as $methodName => $methodDef) { |
|
| 39 | - file_put_contents($targetClassFile, ' ' . str_replace(array('function ', "\n"), array('public static function ', "\n "), $methodDef['source']) . "\n\n", FILE_APPEND) || die('uh oh'); |
|
| 40 | - $code[$methodName]['function'] = 'MyServerClass::' . $methodDef['function']; |
|
| 38 | +foreach ($code as $methodName => $methodDef) { |
|
| 39 | + file_put_contents($targetClassFile, ' '.str_replace(array('function ', "\n"), array('public static function ', "\n "), $methodDef['source'])."\n\n", FILE_APPEND) || die('uh oh'); |
|
| 40 | + $code[$methodName]['function'] = 'MyServerClass::'.$methodDef['function']; |
|
| 41 | 41 | unset($code[$methodName]['source']); |
| 42 | 42 | } |
| 43 | 43 | file_put_contents($targetClassFile, "}\n", FILE_APPEND) || die('uh oh'); |
| 44 | 44 | |
| 45 | 45 | // generate separate files with the xml-rpc server instantiation and its dispatch map |
| 46 | 46 | |
| 47 | -file_put_contents($targetDispatchMapFile, "<?php\n\nreturn " . var_export($code, true) . ";\n"); |
|
| 47 | +file_put_contents($targetDispatchMapFile, "<?php\n\nreturn ".var_export($code, true).";\n"); |
|
| 48 | 48 | |
| 49 | 49 | file_put_contents($targetControllerFile, |
| 50 | - "<?php\n\n" . |
|
| 50 | + "<?php\n\n". |
|
| 51 | 51 | |
| 52 | - "require_once '$autoloader';\n\n" . |
|
| 52 | + "require_once '$autoloader';\n\n". |
|
| 53 | 53 | |
| 54 | - "require_once '$targetClassFile';\n\n" . |
|
| 54 | + "require_once '$targetClassFile';\n\n". |
|
| 55 | 55 | |
| 56 | 56 | // NB: since we are running the generated code within the same script, the existing CommentManager instance will be |
| 57 | 57 | // available for usage by the methods of MyServerClass, as we keep a reference to them within the variable Wrapper::$objHolder |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | // Wrapper::holdObject('xmlrpc_CommentManager_addComment', $cm); |
| 62 | 62 | // Wrapper::holdObject('xmlrpc_CommentManager_getComments', $cm); |
| 63 | 63 | |
| 64 | - "\$dm = require_once '$targetDispatchMapFile';\n" . |
|
| 65 | - '$s = new \PhpXmlRpc\Server($dm, false);' . "\n" . |
|
| 66 | - '// NB: do not leave these 2 debug lines enabled on publicly accessible servers!' . "\n" . |
|
| 67 | - '$s->setDebug(2);' . "\n" . |
|
| 68 | - '$s->exception_handling = 1;' . "\n" . |
|
| 69 | - '$s->service();' . "\n" |
|
| 64 | + "\$dm = require_once '$targetDispatchMapFile';\n". |
|
| 65 | + '$s = new \PhpXmlRpc\Server($dm, false);'."\n". |
|
| 66 | + '// NB: do not leave these 2 debug lines enabled on publicly accessible servers!'."\n". |
|
| 67 | + '$s->setDebug(2);'."\n". |
|
| 68 | + '$s->exception_handling = 1;'."\n". |
|
| 69 | + '$s->service();'."\n" |
|
| 70 | 70 | ) || die('uh oh'); |
| 71 | 71 | |
| 72 | 72 | // test that everything worked by running it in realtime (note that this will return an xml-rpc error message if run |
@@ -182,12 +182,12 @@ discard block |
||
| 182 | 182 | foreach ($mergedOptions as $key => $val) { |
| 183 | 183 | // q: can php be built without ctype? should we use a regexp? |
| 184 | 184 | if (is_string($key) && !ctype_digit($key)) { |
| 185 | - switch($key) { |
|
| 185 | + switch ($key) { |
|
| 186 | 186 | case 'target_charset': |
| 187 | 187 | if (function_exists('mb_convert_encoding')) { |
| 188 | 188 | $this->current_parsing_options['target_charset'] = $val; |
| 189 | 189 | } else { |
| 190 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": 'target_charset' option is unsupported without mbstring"); |
|
| 190 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": 'target_charset' option is unsupported without mbstring"); |
|
| 191 | 191 | } |
| 192 | 192 | break; |
| 193 | 193 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | //$this->_xh['isf'] = 4; |
| 199 | 199 | //$this->_xh['isf_reason'] = "Callback passed as 'methodname_callback' is not callable"; |
| 200 | 200 | //return; |
| 201 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": Callback passed as 'methodname_callback' is not callable"); |
|
| 201 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": Callback passed as 'methodname_callback' is not callable"); |
|
| 202 | 202 | } |
| 203 | 203 | break; |
| 204 | 204 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | break; |
| 210 | 210 | |
| 211 | 211 | default: |
| 212 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": unsupported option: $key"); |
|
| 212 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": unsupported option: $key"); |
|
| 213 | 213 | } |
| 214 | 214 | unset($mergedOptions[$key]); |
| 215 | 215 | } |
@@ -255,10 +255,10 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | try { |
| 257 | 257 | // @see ticket #70 - we have to parse big xml docs in chunks to avoid errors |
| 258 | - for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) { |
|
| 258 | + for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) { |
|
| 259 | 259 | $chunk = substr($data, $offset, $this->maxChunkLength); |
| 260 | 260 | // error handling: xml not well formed |
| 261 | - if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) { |
|
| 261 | + if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) { |
|
| 262 | 262 | $errCode = xml_get_error_code($parser); |
| 263 | 263 | $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode), |
| 264 | 264 | xml_get_current_line_number($parser), xml_get_current_column_number($parser)); |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | break; |
| 269 | 269 | } |
| 270 | 270 | // no need to parse further if we already have a fatal error |
| 271 | - if ($this->_xh['isf'] >= 2) { |
|
| 271 | + if ($this->_xh['isf']>=2) { |
|
| 272 | 272 | break; |
| 273 | 273 | } |
| 274 | 274 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false) |
| 301 | 301 | { |
| 302 | 302 | // if invalid xml-rpc already detected, skip all processing |
| 303 | - if ($this->_xh['isf'] >= 2) { |
|
| 303 | + if ($this->_xh['isf']>=2) { |
|
| 304 | 304 | return; |
| 305 | 305 | } |
| 306 | 306 | |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | $this->_xh['rt'] = strtolower($name); |
| 324 | 324 | } else { |
| 325 | 325 | $this->_xh['isf'] = 2; |
| 326 | - $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name; |
|
| 326 | + $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name; |
|
| 327 | 327 | |
| 328 | 328 | return; |
| 329 | 329 | } |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | case 'MEMBER': |
| 427 | 427 | // set member name to null, in case we do not find in the xml later on |
| 428 | 428 | /// @todo we could reject structs missing a NAME in the MEMBER element |
| 429 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = ''; |
|
| 429 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = ''; |
|
| 430 | 430 | //$this->_xh['ac']=''; |
| 431 | 431 | // Drop trough intentionally |
| 432 | 432 | |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | */ |
| 499 | 499 | public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1) |
| 500 | 500 | { |
| 501 | - if ($this->_xh['isf'] >= 2) { |
|
| 501 | + if ($this->_xh['isf']>=2) { |
|
| 502 | 502 | return; |
| 503 | 503 | |
| 504 | 504 | } |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | $this->_xh['value'] = mb_convert_encoding($this->_xh['value'], $this->current_parsing_options['target_charset'], 'UTF-8'); |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | - if ($rebuildXmlrpcvals > 0) { |
|
| 523 | + if ($rebuildXmlrpcvals>0) { |
|
| 524 | 524 | // build the xml-rpc val out of the data received, and substitute it |
| 525 | 525 | $temp = new Value($this->_xh['value'], $this->_xh['vt']); |
| 526 | 526 | // in case we got info about underlying php class, save it in the object we're rebuilding |
@@ -528,15 +528,15 @@ discard block |
||
| 528 | 528 | $temp->_php_class = $this->_xh['php_class']; |
| 529 | 529 | } |
| 530 | 530 | $this->_xh['value'] = $temp; |
| 531 | - } elseif ($rebuildXmlrpcvals < 0) { |
|
| 531 | + } elseif ($rebuildXmlrpcvals<0) { |
|
| 532 | 532 | if ($this->_xh['vt'] == Value::$xmlrpcDateTime) { |
| 533 | - $this->_xh['value'] = (object)array( |
|
| 533 | + $this->_xh['value'] = (object) array( |
|
| 534 | 534 | 'xmlrpc_type' => 'datetime', |
| 535 | 535 | 'scalar' => $this->_xh['value'], |
| 536 | 536 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value']) |
| 537 | 537 | ); |
| 538 | 538 | } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) { |
| 539 | - $this->_xh['value'] = (object)array( |
|
| 539 | + $this->_xh['value'] = (object) array( |
|
| 540 | 540 | 'xmlrpc_type' => 'base64', |
| 541 | 541 | 'scalar' => $this->_xh['value'] |
| 542 | 542 | ); |
@@ -551,8 +551,8 @@ discard block |
||
| 551 | 551 | // check if we are inside an array or struct: |
| 552 | 552 | // if value just built is inside an array, let's move it into array on the stack |
| 553 | 553 | $vscount = count($this->_xh['valuestack']); |
| 554 | - if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') { |
|
| 555 | - $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value']; |
|
| 554 | + if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') { |
|
| 555 | + $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value']; |
|
| 556 | 556 | } |
| 557 | 557 | break; |
| 558 | 558 | |
@@ -577,11 +577,11 @@ discard block |
||
| 577 | 577 | // log if receiving something strange, even though we set the value to false anyway |
| 578 | 578 | /// @todo to be consistent with the other types, we should use a value outside the good-value domain, e.g. NULL |
| 579 | 579 | if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') !== 0) { |
| 580 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BOOLEAN value: ' . $this->_xh['ac']); |
|
| 580 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in BOOLEAN value: '.$this->_xh['ac']); |
|
| 581 | 581 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) |
| 582 | 582 | { |
| 583 | 583 | $this->_xh['isf'] = 2; |
| 584 | - $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: ' . $this->_xh['ac']; |
|
| 584 | + $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: '.$this->_xh['ac']; |
|
| 585 | 585 | return; |
| 586 | 586 | } |
| 587 | 587 | } |
@@ -600,18 +600,18 @@ discard block |
||
| 600 | 600 | $this->_xh['vt'] = strtolower($name); |
| 601 | 601 | $this->_xh['lv'] = 3; // indicate we've found a value |
| 602 | 602 | if (!preg_match(PhpXmlRpc::$xmlrpc_int_format, $this->_xh['ac'])) { |
| 603 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric data received in INT: ' . $this->_xh['ac']); |
|
| 603 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric data received in INT: '.$this->_xh['ac']); |
|
| 604 | 604 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) |
| 605 | 605 | { |
| 606 | 606 | $this->_xh['isf'] = 2; |
| 607 | - $this->_xh['isf_reason'] = 'Non numeric data received in INT value: ' . $this->_xh['ac']; |
|
| 607 | + $this->_xh['isf_reason'] = 'Non numeric data received in INT value: '.$this->_xh['ac']; |
|
| 608 | 608 | return; |
| 609 | 609 | } |
| 610 | 610 | /// @todo: find a better way of reporting an error value than this! Use NaN? |
| 611 | 611 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
| 612 | 612 | } else { |
| 613 | 613 | // it's ok, add it on |
| 614 | - $this->_xh['value'] = (int)$this->_xh['ac']; |
|
| 614 | + $this->_xh['value'] = (int) $this->_xh['ac']; |
|
| 615 | 615 | } |
| 616 | 616 | break; |
| 617 | 617 | |
@@ -619,18 +619,18 @@ discard block |
||
| 619 | 619 | $this->_xh['vt'] = Value::$xmlrpcDouble; |
| 620 | 620 | $this->_xh['lv'] = 3; // indicate we've found a value |
| 621 | 621 | if (!preg_match(PhpXmlRpc::$xmlrpc_double_format, $this->_xh['ac'])) { |
| 622 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric data received in DOUBLE value: ' . $this->_xh['ac']); |
|
| 622 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric data received in DOUBLE value: '.$this->_xh['ac']); |
|
| 623 | 623 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) |
| 624 | 624 | { |
| 625 | 625 | $this->_xh['isf'] = 2; |
| 626 | - $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: ' . $this->_xh['ac']; |
|
| 626 | + $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: '.$this->_xh['ac']; |
|
| 627 | 627 | return; |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
| 631 | 631 | } else { |
| 632 | 632 | // it's ok, add it on |
| 633 | - $this->_xh['value'] = (double)$this->_xh['ac']; |
|
| 633 | + $this->_xh['value'] = (double) $this->_xh['ac']; |
|
| 634 | 634 | } |
| 635 | 635 | break; |
| 636 | 636 | |
@@ -638,20 +638,20 @@ discard block |
||
| 638 | 638 | $this->_xh['vt'] = Value::$xmlrpcDateTime; |
| 639 | 639 | $this->_xh['lv'] = 3; // indicate we've found a value |
| 640 | 640 | if (!preg_match(PhpXmlRpc::$xmlrpc_datetime_format, $this->_xh['ac'])) { |
| 641 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in DATETIME value: ' . $this->_xh['ac']); |
|
| 641 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in DATETIME value: '.$this->_xh['ac']); |
|
| 642 | 642 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) |
| 643 | 643 | { |
| 644 | 644 | $this->_xh['isf'] = 2; |
| 645 | - $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: ' . $this->_xh['ac']; |
|
| 645 | + $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: '.$this->_xh['ac']; |
|
| 646 | 646 | return; |
| 647 | 647 | } |
| 648 | 648 | } |
| 649 | 649 | if ($this->current_parsing_options['xmlrpc_return_datetimes']) { |
| 650 | 650 | try { |
| 651 | 651 | $this->_xh['value'] = new \DateTime($this->_xh['ac']); |
| 652 | - } catch(\Exception $e) { |
|
| 652 | + } catch (\Exception $e) { |
|
| 653 | 653 | // q: what to do? we can not guarantee that a valid date can be created. Return null or throw? |
| 654 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': ' . $e->getMessage()); |
|
| 654 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': '.$e->getMessage()); |
|
| 655 | 655 | $this->_xh['value'] = null; |
| 656 | 656 | } |
| 657 | 657 | } else { |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) { |
| 666 | 666 | $v = base64_decode($this->_xh['ac'], true); |
| 667 | 667 | if ($v === false) { |
| 668 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value'); |
|
| 668 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value'); |
|
| 669 | 669 | $this->_xh['isf'] = 2; |
| 670 | 670 | $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value'; |
| 671 | 671 | return; |
@@ -674,14 +674,14 @@ discard block |
||
| 674 | 674 | $v = base64_decode($this->_xh['ac']); |
| 675 | 675 | if ($v === '' && $this->_xh['ac'] !== '') { |
| 676 | 676 | // only the empty string should decode to the empty string |
| 677 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value'); |
|
| 677 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value'); |
|
| 678 | 678 | } |
| 679 | 679 | } |
| 680 | 680 | $this->_xh['value'] = $v; |
| 681 | 681 | break; |
| 682 | 682 | |
| 683 | 683 | case 'NAME': |
| 684 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac']; |
|
| 684 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac']; |
|
| 685 | 685 | break; |
| 686 | 686 | |
| 687 | 687 | case 'MEMBER': |
@@ -691,14 +691,14 @@ discard block |
||
| 691 | 691 | // NB: atm we always initialize members with an empty name in xmlrpc__ee, so no need for this check. |
| 692 | 692 | // We could make parsing stricter though... |
| 693 | 693 | //if (isset($this->_xh['valuestack'][$vscount - 1]['name'])) { |
| 694 | - $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value']; |
|
| 694 | + $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value']; |
|
| 695 | 695 | //} else { |
| 696 | 696 | // /// @todo return a parsing error if $this->current_parsing_options['xmlrpc_reject_invalid_values']? |
| 697 | 697 | // $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing NAME inside STRUCT in received xml'); |
| 698 | 698 | //} |
| 699 | 699 | } else { |
| 700 | 700 | /// @todo return a parsing error $this->current_parsing_options['xmlrpc_reject_invalid_values']? |
| 701 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside STRUCT in received xml'); |
|
| 701 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside STRUCT in received xml'); |
|
| 702 | 702 | } |
| 703 | 703 | break; |
| 704 | 704 | |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | $this->_xh['pt'][] = $this->_xh['vt']; |
| 725 | 725 | } else { |
| 726 | 726 | /// @todo return a parsing error? esp. if if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) |
| 727 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside PARAM in received xml'); |
|
| 727 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside PARAM in received xml'); |
|
| 728 | 728 | } |
| 729 | 729 | break; |
| 730 | 730 | |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | public function xmlrpc_cd($parser, $data) |
| 804 | 804 | { |
| 805 | 805 | // skip processing if xml fault already detected |
| 806 | - if ($this->_xh['isf'] >= 2) { |
|
| 806 | + if ($this->_xh['isf']>=2) { |
|
| 807 | 807 | return; |
| 808 | 808 | } |
| 809 | 809 | |
@@ -825,7 +825,7 @@ discard block |
||
| 825 | 825 | public function xmlrpc_dh($parser, $data) |
| 826 | 826 | { |
| 827 | 827 | // skip processing if xml fault already detected |
| 828 | - if ($this->_xh['isf'] >= 2) { |
|
| 828 | + if ($this->_xh['isf']>=2) { |
|
| 829 | 829 | return; |
| 830 | 830 | } |
| 831 | 831 | |
@@ -899,8 +899,8 @@ discard block |
||
| 899 | 899 | // Details: |
| 900 | 900 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
| 901 | 901 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
| 902 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
| 903 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 902 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
| 903 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 904 | 904 | $xmlChunk, $matches)) { |
| 905 | 905 | return strtoupper(substr($matches[2], 1, -1)); |
| 906 | 906 | } |
@@ -918,7 +918,7 @@ discard block |
||
| 918 | 918 | // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII... |
| 919 | 919 | // IANA also likes better US-ASCII, so go with it |
| 920 | 920 | if ($enc == 'ASCII') { |
| 921 | - $enc = 'US-' . $enc; |
|
| 921 | + $enc = 'US-'.$enc; |
|
| 922 | 922 | } |
| 923 | 923 | |
| 924 | 924 | return $enc; |
@@ -955,8 +955,8 @@ discard block |
||
| 955 | 955 | // Details: |
| 956 | 956 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
| 957 | 957 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
| 958 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
| 959 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 958 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
| 959 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 960 | 960 | $xmlChunk)) { |
| 961 | 961 | return true; |
| 962 | 962 | } |
@@ -976,7 +976,7 @@ discard block |
||
| 976 | 976 | break; |
| 977 | 977 | default: |
| 978 | 978 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
| 979 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 979 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 980 | 980 | } |
| 981 | 981 | } |
| 982 | 982 | |
@@ -1000,7 +1000,7 @@ discard block |
||
| 1000 | 1000 | break; |
| 1001 | 1001 | default: |
| 1002 | 1002 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
| 1003 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 1003 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 1004 | 1004 | } |
| 1005 | 1005 | } |
| 1006 | 1006 | } |