diff --git a/CMakeLists.txt b/CMakeLists.txt
index 44217ce992e..406889daf42 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
PROJECT(libswoole)
ENABLE_LANGUAGE(ASM)
-set(SWOOLE_VERSION 4.8.0)
+set(SWOOLE_VERSION 4.8.1)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -g")
diff --git a/config.m4 b/config.m4
index 69056729501..f6124cdc2b3 100644
--- a/config.m4
+++ b/config.m4
@@ -532,6 +532,7 @@ if test "$PHP_SWOOLE" != "no"; then
swoole_source_file=" \
ext-src/php_swoole.cc \
ext-src/php_swoole_cxx.cc \
+ ext-src/swoole_admin_server.cc \
ext-src/swoole_async_coro.cc \
ext-src/swoole_atomic.cc \
ext-src/swoole_channel_coro.cc \
@@ -563,7 +564,6 @@ if test "$PHP_SWOOLE" != "no"; then
ext-src/swoole_table.cc \
ext-src/swoole_timer.cc \
ext-src/swoole_websocket_server.cc \
- ext-src/swoole_admin_server.cc \
src/core/base.cc \
src/core/channel.cc \
src/core/crc32.cc \
diff --git a/ext-src/php_swoole_library.h b/ext-src/php_swoole_library.h
index 157421d0e8a..807fd08d13c 100644
--- a/ext-src/php_swoole_library.h
+++ b/ext-src/php_swoole_library.h
@@ -2,7 +2,7 @@
* Generated by build-library.php, Please DO NOT modify!
*/
-/* $Id: bec0dfe51c53edac6b1f9f96ed16a6b9922c4b6d */
+/* $Id: ffe5a024f97dc4f05ea94a65cc5a7c6c1806d3b3 */
static const char* swoole_library_source_constants =
"\n"
@@ -207,6 +207,8 @@ static const char* swoole_library_source_core_constant =
"\n"
" public const OPTION_SSL_VERIFY_DEPTH = 'ssl_verify_depth';\n"
"\n"
+ " public const OPTION_SSL_CIPHERS = 'ssl_ciphers';\n"
+ "\n"
" public const OPTION_OPEN_EOF_CHECK = 'open_eof_check';\n"
"\n"
" public const OPTION_OPEN_EOF_SPLIT = 'open_eof_split';\n"
@@ -265,6 +267,10 @@ static const char* swoole_library_source_core_constant =
"\n"
" public const OPTION_SSL_DISABLE_COMPRESSION = 'ssl_disable_compression';\n"
"\n"
+ " public const OPTION_SSL_ECDH_CURVE = 'ssl_ecdh_curve';\n"
+ "\n"
+ " public const OPTION_SSL_GREASE = 'ssl_grease';\n"
+ "\n"
" public const OPTION_MAX_CORO_NUM = 'max_coro_num';\n"
"\n"
" public const OPTION_MAX_COROUTINE = 'max_coroutine';\n"
@@ -471,10 +477,6 @@ static const char* swoole_library_source_core_constant =
"\n"
" public const OPTION_SSL_PREFER_SERVER_CIPHERS = 'ssl_prefer_server_ciphers';\n"
"\n"
- " public const OPTION_SSL_CIPHERS = 'ssl_ciphers';\n"
- "\n"
- " public const OPTION_SSL_ECDH_CURVE = 'ssl_ecdh_curve';\n"
- "\n"
" public const OPTION_SSL_DHPARAM = 'ssl_dhparam';\n"
"\n"
" public const OPTION_SSL_SNI_CERTS = 'ssl_sni_certs';\n"
@@ -2017,10 +2019,7 @@ static const char* swoole_library_source_core_database_mysqli_proxy =
" public const IO_METHOD_REGEX = '/^autocommit|begin_transaction|change_user|close|commit|kill|multi_query|ping|prepare|query|real_connect|real_query|reap_async_query|refresh|release_savepoint|rollback|savepoint|select_db|send_query|set_charset|ssl_set$/i';\n"
"\n"
" public const IO_ERRORS = [\n"
- " 2002, \n"
- " 2006, \n"
- " 2013, \n"
- " ];\n"
+ " 2002, 2006, 2013, ];\n"
"\n"
" \n"
" protected $__object;\n"
@@ -2437,10 +2436,7 @@ static const char* swoole_library_source_core_database_pdo_proxy =
" public const IO_METHOD_REGEX = '/^query|prepare|exec|beginTransaction|commit|rollback$/i';\n"
"\n"
" public const IO_ERRORS = [\n"
- " 2002, \n"
- " 2006, \n"
- " 2013, \n"
- " ];\n"
+ " 2002, 2006, 2013, ];\n"
"\n"
" \n"
" protected $__object;\n"
@@ -3415,8 +3411,7 @@ static const char* swoole_library_source_core_curl_handler =
" $this->headers[$headerName] = $value;\n"
" $this->headerMap[$lowerCaseHeaderName] = $headerName;\n"
" } else {\n"
- " \n"
- " unset($this->headerMap[$lowerCaseHeaderName]);\n"
+ " unset($this->headerMap[$lowerCaseHeaderName]);\n"
" }\n"
" }\n"
"\n"
@@ -3424,9 +3419,7 @@ static const char* swoole_library_source_core_curl_handler =
" private function setOption(int $opt, $value): bool\n"
" {\n"
" switch ($opt) {\n"
- " \n"
- " \n"
- " case CURLOPT_FILE:\n"
+ " case CURLOPT_FILE:\n"
" case CURLOPT_INFILE:\n"
" if (!is_resource($value)) {\n"
" trigger_error('swoole_curl_setopt(): supplied argument is not a valid File-Handle resource', E_USER_WARNING);\n"
@@ -3511,8 +3504,7 @@ static const char* swoole_library_source_core_curl_handler =
" foreach ((array) $value as $resolve) {\n"
" $flag = substr($resolve, 0, 1);\n"
" if ($flag === '+' || $flag === '-') {\n"
- " \n"
- " $resolve = substr($resolve, 1);\n"
+ " $resolve = substr($resolve, 1);\n"
" }\n"
" $tmpResolve = explode(':', $resolve, 3);\n"
" $host = $tmpResolve[0] ?? '';\n"
@@ -3521,8 +3513,7 @@ static const char* swoole_library_source_core_curl_handler =
" if ($flag === '-') {\n"
" unset($this->resolve[$host][$port]);\n"
" } else {\n"
- " \n"
- " $this->resolve[$host][$port] = explode(',', $ip)[0];\n"
+ " $this->resolve[$host][$port] = explode(',', $ip)[0];\n"
" }\n"
" }\n"
" break;\n"
@@ -3541,8 +3532,7 @@ static const char* swoole_library_source_core_curl_handler =
" break;\n"
" \n"
" case CURLOPT_VERBOSE:\n"
- " \n"
- " case CURLOPT_SSLVERSION:\n"
+ " case CURLOPT_SSLVERSION:\n"
" case CURLOPT_NOSIGNAL:\n"
" case CURLOPT_FRESH_CONNECT:\n"
" \n"
@@ -3558,6 +3548,7 @@ static const char* swoole_library_source_core_curl_handler =
" case CURLOPT_CERTINFO:\n"
" case CURLOPT_HEADEROPT:\n"
" case CURLOPT_PROXYHEADER:\n"
+ " case CURLOPT_HTTPPROXYTUNNEL:\n"
" break;\n"
" \n"
" case CURLOPT_SSL_VERIFYHOST:\n"
@@ -3801,9 +3792,7 @@ static const char* swoole_library_source_core_curl_handler =
" }\n"
" \n"
" if ($this->infile) {\n"
- " \n"
- " \n"
- " $data = '';\n"
+ " $data = '';\n"
" while (true) {\n"
" $nLength = $this->infileSize - strlen($data);\n"
" if ($nLength === 0) {\n"
@@ -3815,12 +3804,10 @@ static const char* swoole_library_source_core_curl_handler =
" $data .= fread($this->infile, $nLength);\n"
" }\n"
" $client->setData($data);\n"
- " \n"
- " $this->infile = null;\n"
+ " $this->infile = null;\n"
" $this->infileSize = PHP_INT_MAX;\n"
" } else {\n"
- " \n"
- " if ($this->postData) {\n"
+ " if ($this->postData) {\n"
" if (is_string($this->postData)) {\n"
" if (!$this->hasHeader('content-type')) {\n"
" $this->setHeader('Content-Type', 'application/x-www-form-urlencoded');\n"
@@ -3837,10 +3824,7 @@ static const char* swoole_library_source_core_curl_handler =
" $client->setData($this->postData);\n"
" }\n"
" \n"
- " \n"
- " \n"
- " \n"
- " $client->setHeaders($this->headers);\n"
+ " $client->setHeaders($this->headers);\n"
" \n"
" $executeResult = $client->execute($this->getUrl());\n"
" if (!$executeResult) {\n"
@@ -3861,8 +3845,7 @@ static const char* swoole_library_source_core_curl_handler =
" $this->info['starttransfer_time'] = microtime(true) - $timeBegin;\n"
" $redirectBeginTime = microtime(true);\n"
" }\n"
- " \n"
- " if (in_array($client->statusCode, [Status::MOVED_PERMANENTLY, Status::FOUND, Status::SEE_OTHER])) {\n"
+ " if (in_array($client->statusCode, [Status::MOVED_PERMANENTLY, Status::FOUND, Status::SEE_OTHER])) {\n"
" $this->method = 'GET';\n"
" }\n"
" if ($this->autoReferer) {\n"
@@ -4309,8 +4292,7 @@ static const char* swoole_library_source_core_fast_cgi_record_params =
" $format = join('/', $formatParts);\n"
" [$nameLength, $valueLength] = array_values(unpack($format, $data));\n"
"\n"
- " \n"
- " $nameLength &= ($isLongName ? 0x7FFFFFFF : 0x7F);\n"
+ " $nameLength &= ($isLongName ? 0x7FFFFFFF : 0x7F);\n"
" $valueLength &= ($isLongValue ? 0x7FFFFFFF : 0x7F);\n"
"\n"
" [$nameData, $valueData] = array_values(\n"
@@ -5390,23 +5372,19 @@ static const char* swoole_library_source_core_fast_cgi_http_response =
" if (strlen($body) === 0) {\n"
" return;\n"
" }\n"
- " $array = explode(\"\\r\\n\\r\\n\", $body, 2); \n"
- " if (count($array) != 2) {\n"
+ " $array = explode(\"\\r\\n\\r\\n\", $body, 2); if (count($array) != 2) {\n"
" $this->withStatusCode(Status::BAD_GATEWAY)->withReasonPhrase('Invalid FastCGI Response')->withError($body);\n"
" return;\n"
" }\n"
" $headers = explode(\"\\r\\n\", $array[0]);\n"
" $body = $array[1];\n"
" foreach ($headers as $header) {\n"
- " $array = explode(':', $header, 2); \n"
- " if (count($array) != 2) {\n"
- " continue; \n"
- " }\n"
+ " $array = explode(':', $header, 2); if (count($array) != 2) {\n"
+ " continue; }\n"
" $name = trim($array[0]);\n"
" $value = trim($array[1]);\n"
" if (strcasecmp($name, 'Status') === 0) {\n"
- " $array = explode(' ', $value, 2); \n"
- " $statusCode = $array[0];\n"
+ " $array = explode(' ', $value, 2); $statusCode = $array[0];\n"
" $reasonPhrase = $array[1] ?? null;\n"
" } elseif (strcasecmp($name, 'Set-Cookie') === 0) {\n"
" $this->withSetCookieHeaderLine($value);\n"
@@ -5957,6 +5935,8 @@ static const char* swoole_library_source_core_server_admin =
"use Reflection;\n"
"use ReflectionClass;\n"
"use ReflectionExtension;\n"
+ "use ReflectionFunction;\n"
+ "use ReflectionMethod;\n"
"use Swoole\\Coroutine;\n"
"use Swoole\\Http\\Request;\n"
"use Swoole\\Http\\Response;\n"
@@ -5984,7 +5964,7 @@ static const char* swoole_library_source_core_server_admin =
" 'task_worker' => SWOOLE_SERVER_COMMAND_TASK_WORKER,\n"
" ];\n"
"\n"
- " private static $allMap = [\n"
+ " private static $allList = [\n"
" 'all',\n"
" 'all_reactor',\n"
" 'all_reactor_thread',\n"
@@ -5995,7 +5975,7 @@ static const char* swoole_library_source_core_server_admin =
" 'specific',\n"
" ];\n"
"\n"
- " private static $postMethodMap = [\n"
+ " private static $postMethodList = [\n"
" 'server_reload',\n"
" 'server_shutdown',\n"
" 'close_session',\n"
@@ -6066,8 +6046,7 @@ static const char* swoole_library_source_core_server_admin =
" $server->addCommand(\n"
" 'server_setting',\n"
" $accepted_process_types,\n"
- " function ($server, $msg) {\n"
- " \n"
+ " function (Server $server, $msg) {\n"
" $setting = $server->setting;\n"
" $setting['mode'] = $server->mode;\n"
" $setting['host'] = $server->host;\n"
@@ -6187,7 +6166,7 @@ static const char* swoole_library_source_core_server_admin =
" $extensions = get_loaded_extensions();\n"
" $list = [];\n"
" foreach ($extensions as $key => $extension) {\n"
- " $ext = new \\ReflectionExtension($extension);\n"
+ " $ext = new ReflectionExtension($extension);\n"
" $list[$key] = [\n"
" 'id' => ++$key,\n"
" 'name' => $extension,\n"
@@ -6364,7 +6343,7 @@ static const char* swoole_library_source_core_server_admin =
"\n"
" $cmd = $path_array->get(1)->toString();\n"
"\n"
- " if (in_array($cmd, self::$postMethodMap) && $method != 'POST') {\n"
+ " if (in_array($cmd, self::$postMethodList) && $method != 'POST') {\n"
" $resp->status(403);\n"
" $resp->end(self::json('Bad request method', 4003));\n"
" return;\n"
@@ -6400,7 +6379,7 @@ static const char* swoole_library_source_core_server_admin =
" $process_type = SWOOLE_SERVER_COMMAND_MANAGER;\n"
" $process_id = 0;\n"
" } elseif ($process->startsWith('all') || $process->equals('specific')) {\n"
- " if (!in_array($process->toString(), self::$allMap)) {\n"
+ " if (!in_array($process->toString(), self::$allList)) {\n"
" goto _bad_process;\n"
" }\n"
"\n"
@@ -6550,15 +6529,25 @@ static const char* swoole_library_source_core_server_admin =
" public static function handlerGetClassInfo($server, $msg)\n"
" {\n"
" $json = json_decode($msg, true);\n"
- " if (empty($json['class_name'])) {\n"
- " return self::json(['error' => 'require class_name'], 4004);\n"
+ " if (empty($json['class_name']) && empty($json['interface_name'])) {\n"
+ " return self::json(['error' => 'require class_name or interface_name'], 4004);\n"
" }\n"
"\n"
- " if (!class_exists($json['class_name'], false)) {\n"
- " return self::json(\"{$json['class_name']} not exists\", 4003);\n"
+ " if (!empty($json['class_name'])) {\n"
+ " if (!class_exists($json['class_name'], false) && !interface_exists($json['class_name'], false)) {\n"
+ " return self::json(\"{$json['class_name']} not exists\", 4003);\n"
+ " }\n"
+ " $name = $json['class_name'];\n"
" }\n"
"\n"
- " $class = new ReflectionClass($json['class_name']);\n"
+ " if (!empty($json['interface_name'])) {\n"
+ " if (!interface_exists($json['interface_name'], false)) {\n"
+ " return self::json(\"{$json['interface_name']} not exists\", 4003);\n"
+ " }\n"
+ " $name = $json['interface_name'];\n"
+ " }\n"
+ "\n"
+ " $class = new ReflectionClass($name);\n"
"\n"
" $filename = $class->getFileName();\n"
"\n"
@@ -6583,26 +6572,26 @@ static const char* swoole_library_source_core_server_admin =
"\n"
" $getTmpProperties = function ($class, $data) {\n"
" $static = [];\n"
- " $no_static = [];\n"
- " $reflProp = $class->getDefaultProperties();\n"
+ " $noStatic = [];\n"
+ " $defaultProperties = $class->getDefaultProperties();\n"
" foreach ($data as $k => $v) {\n"
" $name = $v->getName();\n"
" $modifiers = Reflection::getModifierNames($v->getModifiers());\n"
" if ($v->isStatic()) {\n"
" $static[] = [\n"
" 'name' => $name,\n"
- " 'value' => $reflProp[$name],\n"
+ " 'value' => $defaultProperties[$name],\n"
" 'modifiers' => implode(' ', $modifiers),\n"
" ];\n"
" } else {\n"
- " $no_static[] = [\n"
+ " $noStatic[] = [\n"
" 'name' => $name,\n"
- " 'value' => $reflProp[$name],\n"
+ " 'value' => $defaultProperties[$name],\n"
" 'modifiers' => implode(' ', $modifiers),\n"
" ];\n"
" }\n"
" }\n"
- " return ['static' => $static, 'no_static' => $no_static];\n"
+ " return ['static' => $static, 'no_static' => $noStatic];\n"
" };\n"
"\n"
" if ($tmpProperties) {\n"
@@ -6617,11 +6606,11 @@ static const char* swoole_library_source_core_server_admin =
"\n"
" $getTmpMethods = function ($data) {\n"
" $static = [];\n"
- " $no_static = [];\n"
+ " $noStatic = [];\n"
" foreach ($data as $k => $v) {\n"
" $name = $v->getName();\n"
" $line = $v->getStartLine();\n"
- " $modifiers = \\Reflection::getModifierNames($v->getModifiers());\n"
+ " $modifiers = Reflection::getModifierNames($v->getModifiers());\n"
" if ($v->isStatic()) {\n"
" $static[] = [\n"
" 'name' => $name,\n"
@@ -6629,14 +6618,14 @@ static const char* swoole_library_source_core_server_admin =
" 'modifiers' => implode(' ', $modifiers),\n"
" ];\n"
" } else {\n"
- " $no_static[] = [\n"
+ " $noStatic[] = [\n"
" 'name' => $name,\n"
" 'line' => $line ?: '',\n"
" 'modifiers' => implode(' ', $modifiers),\n"
" ];\n"
" }\n"
" }\n"
- " return ['static' => $static, 'no_static' => $no_static];\n"
+ " return ['static' => $static, 'no_static' => $noStatic];\n"
" };\n"
"\n"
" if ($tmpStaticMethods) {\n"
@@ -6649,7 +6638,7 @@ static const char* swoole_library_source_core_server_admin =
" $parentClass = $tmpParentClass ? $tmpParentClass->getName() : '';\n"
"\n"
" $tmpInterface = $class->getInterfaceNames();\n"
- " $interface = $tmpInterface ? $tmpInterface : [];\n"
+ " $interface = $tmpInterface ?? [];\n"
"\n"
" $data = [\n"
" 'filename' => $filename,\n"
@@ -6667,23 +6656,41 @@ static const char* swoole_library_source_core_server_admin =
" public static function handlerGetFunctionInfo($server, $msg)\n"
" {\n"
" $json = json_decode($msg, true);\n"
- " if (!$json || empty($json['function_name'])) {\n"
+ "\n"
+ " $className = $json['class_name'] ?? '';\n"
+ " $functionName = $json['function_name'] ?? '';\n"
+ "\n"
+ " if (empty($json) || empty($functionName)) {\n"
" return self::json('require function_name', 4004);\n"
" }\n"
- " if (!function_exists($json['function_name'])) {\n"
- " return self::json(\"{$json['function_name']} not exists\", 4004);\n"
+ "\n"
+ " $isStatic = false;\n"
+ " if (!empty($className)) {\n"
+ " if (!class_exists($className) && !interface_exists($className)) {\n"
+ " return self::json(\"{$className} not exists\", 4004);\n"
+ " }\n"
+ " if (!method_exists($className, $functionName)) {\n"
+ " return self::json(\"{$className}->{$functionName} not exists\", 4004);\n"
+ " }\n"
+ " $ref = new ReflectionMethod($className, $functionName);\n"
+ " $isStatic = $ref->isStatic();\n"
+ " } else {\n"
+ " if (!function_exists($functionName)) {\n"
+ " return self::json(\"{$functionName} not exists\", 4004);\n"
+ " }\n"
+ " $ref = new ReflectionFunction($functionName);\n"
" }\n"
- " $function = new \\ReflectionFunction($json['function_name']);\n"
"\n"
" $result = [\n"
- " 'filename' => $function->getFileName(),\n"
- " 'line' => $function->getStartLine() ?? '',\n"
- " 'num' => $function->getNumberOfParameters(),\n"
- " 'user_defined' => $function->isUserDefined(),\n"
- " 'extension' => $function->getExtensionName(),\n"
+ " 'filename' => $ref->getFileName(),\n"
+ " 'line' => $ref->getStartLine() ?? '',\n"
+ " 'num' => $ref->getNumberOfParameters(),\n"
+ " 'user_defined' => $ref->isUserDefined(),\n"
+ " 'extension' => $ref->getExtensionName(),\n"
+ " 'is_static' => $isStatic,\n"
" ];\n"
"\n"
- " $params = $function->getParameters();\n"
+ " $params = $ref->getParameters();\n"
"\n"
" $list = [];\n"
" foreach ($params as $param) {\n"
@@ -6693,15 +6700,15 @@ static const char* swoole_library_source_core_server_admin =
"\n"
" if ($param->hasType()) {\n"
" \n"
- " $getType = $param->getType();\n"
- " if ($getType instanceof \\ReflectionUnionType) {\n"
+ " $reflection = $param->getType();\n"
+ " if ($reflection instanceof \\ReflectionUnionType) {\n"
" $unionType = [];\n"
- " foreach ($getType->getTypes() as $objType) {\n"
+ " foreach ($reflection->getTypes() as $objType) {\n"
" $unionType[] = $objType->getName();\n"
" }\n"
" $type = implode('|', $unionType);\n"
" } else {\n"
- " $type = $getType->getName();\n"
+ " $type = $reflection->getName();\n"
" }\n"
" }\n"
"\n"
@@ -6804,7 +6811,7 @@ static const char* swoole_library_source_core_server_admin =
" $arr['internal'] = $functions['internal'];\n"
"\n"
" foreach ($functions['user'] as $function_name) {\n"
- " $function = new \\ReflectionFunction($function_name);\n"
+ " $function = new ReflectionFunction($function_name);\n"
" $filename = $function->getFileName();\n"
" $line = $function->getStartLine();\n"
" $arr['user'][] = [\n"
@@ -6823,7 +6830,7 @@ static const char* swoole_library_source_core_server_admin =
" $arr = [];\n"
" if ($classes) {\n"
" foreach ($classes as $classes_name) {\n"
- " $function = new \\ReflectionClass($classes_name);\n"
+ " $function = new ReflectionClass($classes_name);\n"
" $filename = $function->getFileName();\n"
" $line = $function->getStartLine();\n"
" $arr[] = [\n"
@@ -6856,8 +6863,7 @@ static const char* swoole_library_source_core_server_admin =
" $result['total'] = $total;\n"
"\n"
" $result['memory_size'] = 0;\n"
- " \n"
- " if (PHP_OS_FAMILY === 'Linux') {\n"
+ " if (PHP_OS_FAMILY === 'Linux') {\n"
" preg_match('#MemTotal:\\s+(\\d+) kB#i', file_get_contents('/proc/meminfo'), $match);\n"
" $result['memory_size'] = $match[1] * 1024;\n"
" }\n"
@@ -6898,21 +6904,15 @@ static const char* swoole_library_source_core_server_admin =
" return self::json(['error' => 'require property_name!'], 4004);\n"
" }\n"
"\n"
- " $class_name = $json['class_name'];\n"
- " $property_name = $json['property_name'];\n"
+ " $className = $json['class_name'];\n"
+ " $propertyName = $json['property_name'];\n"
"\n"
- " $refClass = new ReflectionClass($class_name);\n"
- " if (!$refClass) {\n"
- " return self::json(\"class[{$class_name}] not exists\", 4004);\n"
+ " if (!class_exists($className)) {\n"
+ " return self::json(\"class[{$className}] not exists\", 4004);\n"
" }\n"
"\n"
- " $property = $refClass->getProperty($property_name);\n"
- " if (!$property) {\n"
- " return self::json(\"property[{$property_name}] not exists\", 4004);\n"
- " }\n"
- "\n"
- " $property->setAccessible(true);\n"
- " $value = $property->getValue($property_name);\n"
+ " $reflection = new ReflectionClass($className);\n"
+ " $value = $reflection->getStaticPropertyValue($propertyName, []);\n"
"\n"
" $result = [\n"
" 'value' => var_export($value, true),\n"
@@ -6922,7 +6922,7 @@ static const char* swoole_library_source_core_server_admin =
"\n"
" private static function handlerMulti(Server $server, array $list)\n"
" {\n"
- " $returnList = [];\n"
+ " $return_list = [];\n"
" foreach ($list as $key => $content) {\n"
" $path_array = swoole_string($content['path'])->trim('/')->split('/');\n"
" $cmd = $path_array->get(1)->toString();\n"
@@ -6947,20 +6947,20 @@ static const char* swoole_library_source_core_server_admin =
" $process_type = SWOOLE_SERVER_COMMAND_MANAGER;\n"
" $process_id = 0;\n"
" } elseif ($process->startsWith('all') || $process->startsWith('specific')) {\n"
- " if (!in_array($process->toString(), self::$allMap) && !$process->startsWith('specific')) {\n"
- " $returnList[$key] = json_decode('{}');\n"
+ " if (!in_array($process->toString(), self::$allList) && !$process->startsWith('specific')) {\n"
+ " $return_list[$key] = json_decode('{}');\n"
" continue;\n"
" }\n"
"\n"
" $result = self::handlerGetAll($server, $process, $cmd, $data);\n"
"\n"
- " $returnList[$key] = ['code' => 0, 'data' => $result];\n"
+ " $return_list[$key] = ['code' => 0, 'data' => $result];\n"
" continue;\n"
" } else {\n"
" $array = $process->split('-');\n"
"\n"
" if ($array->count() != 2 || !isset(self::$map[$array->get(0)->toString()])) {\n"
- " $returnList[$key] = json_decode('{}');\n"
+ " $return_list[$key] = json_decode('{}');\n"
" continue;\n"
" }\n"
"\n"
@@ -6968,10 +6968,10 @@ static const char* swoole_library_source_core_server_admin =
" $process_id = intval($array->get(1)->toString());\n"
" }\n"
"\n"
- " $returnList[$key] = $server->command($cmd, $process_id, intval($process_type), $data, true);\n"
+ " $return_list[$key] = $server->command($cmd, $process_id, intval($process_type), $data, true);\n"
" }\n"
"\n"
- " return $returnList;\n"
+ " return $return_list;\n"
" }\n"
"\n"
" private static function handlerGetAll(Server $server, StringObject $process, $cmd, $data, bool $json_decode = true)\n"
@@ -6988,8 +6988,7 @@ static const char* swoole_library_source_core_server_admin =
" } elseif ($process->startsWith('all_task')) {\n"
" $result = self::handlerGetAllTaskWorker($cmd, $data, $server, $json_decode);\n"
" } else {\n"
- " \n"
- " $result = [];\n"
+ " $result = [];\n"
" if (!empty($data['workers']) && is_array($data['workers'])) {\n"
" foreach ($data['workers'] as $name) {\n"
" $process = swoole_string($name);\n"
@@ -7076,8 +7075,7 @@ static const char* swoole_library_source_core_server_admin =
"\n"
" private static function getProcessCpuUsage($pid)\n"
" {\n"
- " \n"
- " if (PHP_OS_FAMILY !== 'Linux') {\n"
+ " if (PHP_OS_FAMILY !== 'Linux') {\n"
" return [0];\n"
" }\n"
"\n"
@@ -7109,8 +7107,7 @@ static const char* swoole_library_source_core_server_admin =
" private static function getProcessStatus($pid = 'self')\n"
" {\n"
" $array = [];\n"
- " \n"
- " if (PHP_OS_FAMILY !== 'Linux') {\n"
+ " if (PHP_OS_FAMILY !== 'Linux') {\n"
" return $array;\n"
" }\n"
" $status = swoole_string(trim(file_get_contents('/proc/' . $pid . '/status')));\n"
@@ -7342,8 +7339,7 @@ static const char* swoole_library_source_core_server_helper =
"\n"
" foreach ($input_options as $k => $v) {\n"
" if (!array_key_exists(strtolower($k), $const_options)) {\n"
- " \n"
- " trigger_error(\"unsupported option [{$k}]\", E_USER_WARNING);\n"
+ " trigger_error(\"unsupported option [{$k}]\", E_USER_WARNING);\n"
" debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);\n"
" }\n"
" }\n"
@@ -7525,8 +7521,7 @@ static const char* swoole_library_source_core_coroutine_functions =
" echo Coroutine::printBackTrace($cid, DEBUG_BACKTRACE_IGNORE_ARGS, $depth);\n"
" echo \"\\n\";\n"
" $index++;\n"
- " \n"
- " if ($index >= $limit) {\n"
+ " if ($index >= $limit) {\n"
" break;\n"
" }\n"
" }\n"
diff --git a/include/swoole_version.h b/include/swoole_version.h
index 6e6ca19bd73..79f4ba08a78 100644
--- a/include/swoole_version.h
+++ b/include/swoole_version.h
@@ -20,11 +20,11 @@
#define SWOOLE_MAJOR_VERSION 4
#define SWOOLE_MINOR_VERSION 8
-#define SWOOLE_RELEASE_VERSION 0
+#define SWOOLE_RELEASE_VERSION 1
#define SWOOLE_EXTRA_VERSION ""
-#define SWOOLE_VERSION "4.8.0"
-#define SWOOLE_VERSION_ID 40800
-#define SWOOLE_API_VERSION_ID 0x202012a
+#define SWOOLE_VERSION "4.8.1"
+#define SWOOLE_VERSION_ID 40801
+#define SWOOLE_API_VERSION_ID 0x202109a
#define SWOOLE_BUG_REPORT \
"A bug occurred in Swoole-v" SWOOLE_VERSION ", please report it.\n" \
diff --git a/package.xml b/package.xml
index 69856a2c600..15078e13ac9 100644
--- a/package.xml
+++ b/package.xml
@@ -51,10 +51,10 @@
doubaokun@php.net
yes
- 2021-10-12
-
+ 2021-10-27
+
- 4.8.0
+ 4.8.1
4.0
@@ -65,32 +65,25 @@
New APIs
---
- * Added Co::getStackUsage() (#4398) (@matyhtf) (@twose)
- * Added Coroutine\Redis some api (#4390) (@chrysanthemum)
- * Added Table::stats() (#4405) (@matyhtf)
- * Added Coroutine::join() (#4406) (@matyhtf)
-
- New feature
- ---
- * Supported server command (#4389) (@matyhtf)
- * Supported Server::onBeforeShutdown callback (#4415) (@matyhtf)
+ * Added swoole_error_log_ex(), swoole_ignore_error() (#4440) (@matyhtf)
Enhancement
---
- * Set error code when websocket pack fails (swoole/swoole-src@d27c5a5) (@matyhtf)
- * Added Timer::exec_count field (#4402) (@matyhtf)
- * Supported for hooked mkdir using open_basedir ini config (#4407) (@NathanFreeman)
- * Added vendor_init.php (swoole/library@6c40b02) (@matyhtf)
- * Supported CURLOPT_UNIX_SOCKET_PATH for SWOOLE_HOOK_CURL (swoole/library#121) (@sy-records)
- * Supported ssl_ciphers config for client (#4432) (@amuluowin)
+ * Migrate admin api from ext-swoole_plus to swoole-src (#4441) (@matyhtf)
+ * Added get_composer_packages command for admin server (swoole/library@07763f46) (swoole/library@8805dc05) (swoole/library@175f1797) (@sy-records) (@yunbaoi)
+ * Added POST method request restrictions for write operations (swoole/library@ac16927c) (@yunbaoi)
+ * Supported to get the method information of the class by get_function_info (swoole/library@690a1952) (@djw1028769140) (@sy-records)
+ * Optimized admin server code (swoole/library#128) (swoole/library#131) (@sy-records)
+ * Supported to request multiple groups of server information for admin server (swoole/library#124) (@sy-records)
+ * Supported to get interface info for admin server (swoole/library#130) (@sy-records)
+ * Supported CURLOPT_HTTPPROXYTUNNEL for SWOOLE_HOOK_CURL (swoole/library#126) (@sy-records)
Fixed
---
- * Fixed unnecessary URL decode of file names when uploading files (swoole/swoole-src@a73780e) (@matyhtf)
- * Fixed HTTP2 max_frame_size error (#4394) (@twose)
- * Fixed curl_multi_select bug #4393 (#4418) (@matyhtf)
- * Fixed missing coroutine options (#4425) (@sy-records)
- * Fixed connection cannot be forcibly closed when the send buffer is full (swoole/swoole-src@2198378) (@matyhtf)
+ * Prohibit coroutine concurrent join (#4442) (@matyhtf)
+ * Fixed init_row, don't clear lock_ and lock_pid (#4446) (@Txhua) (@matyhtf)
+ * Fixed missing helper options (swoole/library#123) (@sy-records)
+ * Fixed get_static_property_value command error (swoole/library#129) (@sy-records)
@@ -523,6 +516,8 @@
+
+
@@ -531,11 +526,14 @@
+
+
+
@@ -994,6 +992,7 @@
+
@@ -1196,6 +1195,7 @@
+
@@ -2099,6 +2099,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/core/error.cc b/src/core/error.cc
index 288600a6948..94a90a9df36 100644
--- a/src/core/error.cc
+++ b/src/core/error.cc
@@ -31,7 +31,8 @@ const char *swoole_strerror(int code) {
return strerror(code);
}
/* swstrerror {{{*/
- switch (code) {
+ switch(code)
+ {
case SW_ERROR_MALLOC_FAIL:
return "Malloc fail";
case SW_ERROR_SYSTEM_CALL_FAIL:
@@ -243,7 +244,7 @@ const char *swoole_strerror(int code) {
#endif
return buffer;
}
- /*}}}*/
+/*}}}*/
}
void swoole_throw_error(int code) {