mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-01 19:27:39 +08:00
Fixed is_resource
does not works when use Runtime::enableCoroutine()
privately in filesystem. (#1854)
This commit is contained in:
parent
dc4cf6dfe3
commit
7b363af5a1
@ -44,6 +44,7 @@
|
||||
## Fixed
|
||||
|
||||
- [#1825](https://github.com/hyperf/hyperf/pull/1825) Fixed `TypeError` for `StartServer::execute`.
|
||||
- [#1854](https://github.com/hyperf/hyperf/pull/1854) Fixed `is_resource` does not works when use `Runtime::enableCoroutine()` privately in filesystem.
|
||||
|
||||
## Optimized
|
||||
|
||||
|
@ -10,12 +10,11 @@ declare(strict_types=1);
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Oss\OssClient {
|
||||
use Swoole\Runtime;
|
||||
|
||||
function is_resource($resource)
|
||||
{
|
||||
if (! function_exists('swoole_hook_flags')) {
|
||||
return \is_resource($resource) || $resource instanceof \Swoole\Curl\Handler;
|
||||
}
|
||||
if (swoole_hook_flags() & SWOOLE_HOOK_CURL) {
|
||||
if (Runtime::getHookFlags() & SWOOLE_HOOK_CURL) {
|
||||
return \is_resource($resource) || $resource instanceof \Swoole\Curl\Handler;
|
||||
}
|
||||
return \is_resource($resource);
|
||||
@ -23,12 +22,11 @@ namespace Oss\OssClient {
|
||||
}
|
||||
|
||||
namespace Oss\Http {
|
||||
use Swoole\Runtime;
|
||||
|
||||
function is_resource($resource)
|
||||
{
|
||||
if (! function_exists('swoole_hook_flags')) {
|
||||
return \is_resource($resource) || $resource instanceof \Swoole\Curl\Handler;
|
||||
}
|
||||
if (swoole_hook_flags() & SWOOLE_HOOK_CURL) {
|
||||
if (Runtime::getHookFlags() & SWOOLE_HOOK_CURL) {
|
||||
return \is_resource($resource) || $resource instanceof \Swoole\Curl\Handler;
|
||||
}
|
||||
return \is_resource($resource);
|
||||
|
@ -439,11 +439,11 @@ if (! function_exists('run')) {
|
||||
|
||||
if (! function_exists('swoole_hook_flags')) {
|
||||
/**
|
||||
* Return the currently enabled swoole hook flags.
|
||||
* Return the default swoole hook flags, you can rewrite it by defining `SWOOLE_HOOK_FLAGS`.
|
||||
*/
|
||||
function swoole_hook_flags(): int
|
||||
{
|
||||
return \Swoole\Runtime::getHookFlags();
|
||||
return defined('SWOOLE_HOOK_FLAGS') ? SWOOLE_HOOK_FLAGS : SWOOLE_HOOK_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user