Skip to content

Commit 7cf70e6

Browse files
committed
bug fix
1 parent 6b805c9 commit 7cf70e6

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/Controller.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ abstract class Controller {
1818
* @var null|int|bool
1919
*/
2020
private $client_time_difference;
21-
public ?string $json_response_enmsg, $json_response_cnmsg;
22-
public ?int $json_response_code, $client_request_pack_timestamp = null;
21+
public ?string $json_response_enmsg = null, $json_response_cnmsg = null;
22+
public ?int $json_response_code = null, $client_request_pack_timestamp = null;
2323
public ?string $encrypt_key = null;
2424
public static function getInstance(bool $create_if_not_exists = true): ?Controller {
2525
$ob = \SysContext::get('controller');
@@ -240,6 +240,10 @@ protected function echoJson(int $code, string $enmsg, ?string $cnmsg, $data): vo
240240
$this->swoole_http_response->detach();
241241
\Swango\HttpServer::getWorker()->taskwait(pack('CN', 16, $this->swoole_http_response->fd) .
242242
$this->encrypt_key . $echo, 5);
243+
$this->response_finished = true;
244+
if (! isset($this->json_response_code)) {
245+
$this->json_response_code = 200;
246+
}
243247
}
244248
} else {
245249
$this->swoole_http_response->header('Access-Control-Allow-Headers', 'Content-Type, Mango-Request-Rand');

src/Handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ private static function parseRequest(\Swoole\Http\Request $request, \Swoole\Http
271271
} else {
272272
\SysContext::set('client_version', '0.0.0');
273273
}
274-
\SysContext::set('request_post', $data->data);
274+
\SysContext::set('request_post', is_array($data->data) ? new \stdClass() : $data->data);
275275
if ($controller::USE_SESSION && ! $controller::START_SESSION_LATER && property_exists($data, 'sid')) {
276276
\session::start($request, $response, $sid, $data->ua);
277277
return true;

src/HttpServer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,9 @@ protected function _mangoParseRequestBody(int $cmd, int $index, string &$data) {
356356
$certs[$index] = null;
357357
}
358358
if ($cmd === 1) {
359-
return mangoParseRequest($data, 2, $index, false);
359+
return mangoParseRequest($data, $index, false);
360360
} else {
361-
return mangoParseRequestRaw($data, 2, $index, false);
361+
return mangoParseRequestRaw($data, $index, false);
362362
}
363363
}
364364
protected function _mangoEncryptResponseBody(int $fd, string &$data) {

0 commit comments

Comments
 (0)