This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace Laravoole\Wrapper; |
||
3 | |||
4 | use swoole_http_server; |
||
5 | |||
6 | use Laravoole\Base; |
||
7 | use Exception; |
||
8 | |||
9 | abstract class Swoole extends Base |
||
10 | { |
||
11 | |||
12 | // http://wiki.swoole.com/wiki/page/274.html |
||
13 | public static function getParams() |
||
14 | { |
||
15 | return [ |
||
16 | 'reactor_num', |
||
17 | 'worker_num', |
||
18 | 'max_request' => 2000, |
||
19 | 'max_conn', |
||
20 | 'task_worker_num', |
||
21 | 'task_ipc_mode', |
||
22 | 'task_max_request', |
||
23 | 'task_tmpdir', |
||
24 | 'dispatch_mode', |
||
25 | 'message_queue_key', |
||
26 | 'daemonize' => 1, |
||
27 | 'backlog', |
||
28 | 'log_file' => [self::class, 'getLogFile'], |
||
29 | 'log_level', |
||
30 | 'heartbeat_check_interval', |
||
31 | 'heartbeat_idle_time', |
||
32 | 'open_eof_check', |
||
33 | 'open_eof_split', |
||
34 | 'package_eof', |
||
35 | 'open_length_check', |
||
36 | 'package_length_type', |
||
37 | 'package_max_length', |
||
38 | 'open_cpu_affinity', |
||
39 | 'cpu_affinity_ignore', |
||
40 | 'open_tcp_nodelay', |
||
41 | 'tcp_defer_accept', |
||
42 | 'ssl_cert_file', |
||
43 | 'ssl_method', |
||
44 | 'user', |
||
45 | 'group', |
||
46 | 'chroot', |
||
47 | 'pipe_buffer_size', |
||
48 | 'buffer_output_size', |
||
49 | 'enable_unsafe_event', |
||
50 | 'discard_timeout_request', |
||
51 | 'enable_reuse_port', |
||
52 | ]; |
||
53 | } |
||
54 | |||
55 | 12 | public function start() |
|
56 | { |
||
57 | 12 | $callbacks = array_merge([ |
|
58 | 12 | 'Start' => [$this, 'onServerStart'], |
|
59 | 12 | 'Shutdown' => [$this, 'onServerShutdown'], |
|
60 | 12 | 'WorkerStart' => [$this, 'onWorkerStart'], |
|
61 | 12 | ], $this->callbacks); |
|
62 | 12 | if (isset($this->wrapper_config['swoole_ontask'])) { |
|
63 | $callbacks['Task'] = $this->wrapper_config['swoole_ontask']; |
||
64 | 2 | $callbacks['Finish'] = $this->wrapper_config['swoole_onfinish']; |
|
65 | } |
||
66 | 12 | foreach ($callbacks as $on => $method) { |
|
67 | 12 | $this->server->on($on, $method); |
|
0 ignored issues
–
show
|
|||
68 | 6 | } |
|
69 | 12 | return $this->server->start(); |
|
0 ignored issues
–
show
The method
start() does not seem to exist on object<Laravoole\Workerman\Worker> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @codeCoverageIgnore |
||
74 | */ |
||
75 | public function onServerStart() |
||
76 | { |
||
77 | // put pid |
||
78 | file_put_contents( |
||
79 | $this->pid_file, |
||
80 | $this->getPid() |
||
81 | ); |
||
82 | } |
||
83 | |||
84 | 12 | public function onWorkerStart($serv, $worker_id) |
|
85 | { |
||
86 | 12 | parent::prepareKernel(); |
|
0 ignored issues
–
show
It seems like you call parent on a different method (
prepareKernel() instead of onWorkerStart() ). Are you sure this is correct? If so, you might want to change this to $this->prepareKernel() .
This check looks for a call to a parent method whose name is different than the method from which it is called. Consider the following code: class Daddy
{
protected function getFirstName()
{
return "Eidur";
}
protected function getSurName()
{
return "Gudjohnsen";
}
}
class Son
{
public function getFirstName()
{
return parent::getSurname();
}
}
The ![]() |
|||
87 | 12 | $server = $this->server; |
|
88 | 12 | $this->app->singleton('laravoole.server', function ($app) use ($server) { |
|
0 ignored issues
–
show
|
|||
89 | return $server; |
||
90 | 12 | }); |
|
91 | 12 | } |
|
92 | |||
93 | /** |
||
94 | * @codeCoverageIgnore |
||
95 | */ |
||
96 | public function onServerShutdown($serv) |
||
0 ignored issues
–
show
|
|||
97 | { |
||
98 | @unlink($this->pid_file); |
||
0 ignored issues
–
show
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.
If you suppress an error, we recommend checking for the error condition explicitly: // For example instead of
@mkdir($dir);
// Better use
if (@mkdir($dir) === false) {
throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
![]() |
|||
99 | } |
||
100 | |||
101 | public static function getLogFile() |
||
102 | { |
||
103 | return app()->storagePath() . '/logs/laravoole.log'; |
||
104 | } |
||
105 | |||
106 | 6 | public function on($event, callable $callback) |
|
107 | 6 | { |
|
108 | return $this->server->on($event, $callback); |
||
0 ignored issues
–
show
The method
on() does not seem to exist on object<Laravoole\Workerman\Worker> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
109 | } |
||
110 | |||
111 | public function send($fd, $content) |
||
112 | { |
||
113 | return $this->server->send($fd, $content); |
||
0 ignored issues
–
show
The method
send() does not seem to exist on object<Laravoole\Workerman\Worker> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
114 | } |
||
115 | |||
116 | 2 | public function close($fd) |
|
117 | { |
||
118 | 2 | return $this->server->close($fd); |
|
0 ignored issues
–
show
The method
close() does not seem to exist on object<Laravoole\Workerman\Worker> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
119 | } |
||
120 | |||
121 | public function getPid() |
||
122 | { |
||
123 | return $this->server->master_pid; |
||
124 | } |
||
125 | |||
126 | |||
127 | } |
||
128 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.