Skip to content

Commit ad997f0

Browse files
author
Denis Cornehl
committed
error is always a key-value-structure
1 parent 49a0bc6 commit ad997f0

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

phpcclib.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,8 +1186,6 @@ public function __construct($message, $status)
11861186
{
11871187
$this->message = $message;
11881188

1189-
1190-
$msgs = array();
11911189
$obj = json_decode($message);
11921190
if (json_last_error() === JSON_ERROR_NONE && !empty($obj)) {
11931191
$rc = "";
@@ -1199,25 +1197,17 @@ public function __construct($message, $status)
11991197
$errors = $v;
12001198
}
12011199

1202-
if (count($errors) > 0)
1203-
$msgs = $errors;
1204-
else if (strlen($rc) > 0)
1205-
$this->message = $rc;
1206-
else
1207-
$this->message = $message;
1208-
}
1209-
1210-
if (count($msgs) > 0) {
1211-
$this->message = '';
1200+
if (count($errors) > 0) {
1201+
$this->message = '';
12121202

1213-
if (is_array($msgs) || $msgs instanceof Traversable || $msgs instanceof stdClass) {
12141203
foreach ($msgs as $k => $v) {
12151204
$this->message .= sprintf("%s: %s\n", $k, $v);
12161205
}
1217-
}else
1206+
} else if (strlen($rc) > 0)
1207+
$this->message = $rc;
1208+
else
12181209
$this->message = $message;
1219-
1220-
}
1210+
}
12211211
}
12221212
}
12231213

0 commit comments

Comments
 (0)