}
} else {
-
- if (! empty($crypt_parser->error)) {
+ if (! empty($crypt_parser->remoteerror)) {
+ $this->error[] = '4: remote server error: ' . $crypt_parser->remoteerror;
+ } else if (! empty($crypt_parser->error)) {
$crypt_parser_error = $crypt_parser->error[0];
$message = '3:XML Parse error in payload: '.$crypt_parser_error['string']."\n";
$this->payload_encrypted = false;
$this->cipher = array();
$this->error = array();
+ $this->remoteerror = null;
+ $this->errorstarted = false;
return true;
}
}
}
+ if (!empty($this->remoteerror)) {
+ return false;
+ }
+
if (count($this->cipher) > 0) {
$this->cipher = array_values($this->cipher);
$this->payload_encrypted = true;
$this->cipher[$this->tag_number] = '';
$handler = 'parse_cipher';
break;
+ case 'FAULT':
+ $handler = 'parse_fault';
default:
break;
}
* @return bool True
*/
function discard_data($parser, $data) {
- // Not interested
+ if (!$this->errorstarted) {
+ // Not interested
+ return true;
+ }
+ $data = trim($data);
+ if (isset($this->errorstarted->faultstringstarted) && !empty($data)) {
+ $this->remoteerror .= ', message: ' . $data;
+ } else if (isset($this->errorstarted->faultcodestarted)) {
+ $this->remoteerror = 'code: ' . $data;
+ unset($this->errorstarted->faultcodestarted);
+ } else if ($data == 'faultCode') {
+ $this->errorstarted->faultcodestarted = true;
+ } else if ($data == 'faultString') {
+ $this->errorstarted->faultstringstarted = true;
+ }
+ return true;
+
+ }
+
+ function parse_fault($parser, $data) {
+ $this->errorstarted = new StdClass;
return true;
}