swooletw / laravel-swoole

High performance HTTP server based on Swoole. Speed up your Laravel or Lumen applications.
MIT License
4.04k stars 390 forks source link

fix could not working onTask when enabling task_enable_coroutine on swoole_http.php #483

Closed m3m0r7 closed 3 years ago

m3m0r7 commented 3 years ago

I enabled task_enable_coroutine on swoole_http.php, it does not work because it will pass 2 arguments (\Swoole\Server $server and Task $task only), not 4 arguments when enabling task_enable_coroutine.

Symfony\Component\Debug\Exception\FatalErrorException:

Uncaught ArgumentCountError: Too few arguments to function SwooleTW\Http\Server\Manager::onTask(), 2 passed and exactly 4 expected in /var/www/html/vendor/swooletw/laravel-swoole/src/Server/Manager.php:266

   > 266|     public function onTask($server, $taskId, $srcWorkerId, $data)
     267|     {
     268|         $this->container->make('events')->dispatch('swoole.task', func_get_args());
     269|
     270|         try {

This commit will fix it.