File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -1163,6 +1163,10 @@ bool PHPCoroutine::disable_hook() {
11631163}
11641164
11651165static PHP_METHOD (swoole_runtime, enableCoroutine) {
1166+ if (!SWOOLE_G (cli)) {
1167+ php_swoole_fatal_error (E_ERROR, " must be used in PHP CLI mode" );
1168+ RETURN_FALSE;
1169+ }
11661170 zval *zflags = nullptr ;
11671171 zend_long flags = PHPCoroutine::HOOK_ALL;
11681172
@@ -1200,6 +1204,10 @@ static PHP_METHOD(swoole_runtime, getHookFlags) {
12001204}
12011205
12021206static PHP_METHOD (swoole_runtime, setHookFlags) {
1207+ if (!SWOOLE_G (cli)) {
1208+ php_swoole_fatal_error (E_ERROR, " must be used in PHP CLI mode" );
1209+ RETURN_FALSE;
1210+ }
12031211 zend_long flags = PHPCoroutine::HOOK_ALL;
12041212
12051213 ZEND_PARSE_PARAMETERS_START (1 , 1 )
You can’t perform that action at this time.
0 commit comments