Issues (13)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/QueuePoolCommand.php (9 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Wanghanlin\QueuePool;
4
5
use Illuminate\Console\Command;
6
7
class QueuePoolCommand extends Command
8
{
9
    /**
10
     * The console command name.
11
     *
12
     * @var string
13
     */
14
    protected $signature = 'queue:pool
15
                            {connection? : The name of the queue connection to work}
16
                            {--workers= : The amount of the workers to start}
17
                            {--queue= : The names of the queues to work}
18
                            {--delay=0 : The number of seconds to delay failed jobs}
19
                            {--force : Force the worker to run even in maintenance mode}
20
                            {--memory=128 : The memory limit in megabytes}
21
                            {--sleep=3 : Number of seconds to sleep when no job is available}
22
                            {--timeout=60 : The number of seconds a child process can run}
23
                            {--tries=0 : Number of times to attempt a job before logging it failed}';
24
25
    /**
26
     * The console command description.
27
     *
28
     * @var string
29
     */
30
    protected $description = 'Start a pool of workers to process the queue';
31
32
    /**
33
     * The queue pool instance.
34
     *
35
     * @var QueuePool
36
     */
37
    protected $pool;
38
39
    /**
40
     * Create a new queue work command.
41
     *
42
     * @param  QueuePool  $pool
43
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
44
     */
45
    public function __construct(QueuePool $pool)
46
    {
47
        parent::__construct();
48
        $this->setOutputHandler($this->pool = $pool);
49
    }
50
51
    /**
52
     * Execute the console command.
53
     *
54
     * @return void
55
     */
56
    public function handle()
57
    {
58
        // We need to get the right queue for the connection which is set in the queue
59
        // configuration file for the application. We will pull it based on the set
60
        // connection being run for the queue operation currently being executed.
61
        $queue = $this->getQueue(
62
            $connection = $this->input->getArgument('connection')
63
        );
64
        $this->pool->start(
65
            $connection, $queue, $this->gatherOptions()
66
        );
67
    }
68
69
    /**
70
     * Get the name of the queue connection to listen on.
71
     *
72
     * @param  string  $connection
73
     * @return string
74
     */
75
    protected function getQueue($connection)
76
    {
77
        $connection = $connection ?: $this->laravel['config']['queue.default'];
78
79
        return $this->input->getOption('queue') ?: $this->laravel['config']->get(
80
            "queue.connections.{$connection}.queue", 'default'
81
        );
82
    }
83
84
    /**
85
     * Get the listener options for the command.
86
     *
87
     * @return QueuePoolOption
88
     */
89
    protected function gatherOptions()
90
    {
91
        return new QueuePoolOption(
92
            $this->option('workers'), $this->option('env'),
0 ignored issues
show
$this->option('workers') is of type string|array, but the function expects a integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
It seems like $this->option('env') targeting Illuminate\Console\Command::option() can also be of type array; however, Wanghanlin\QueuePool\Que...olOption::__construct() does only seem to accept string|null, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
93
            $this->option('delay'), $this->option('memory'),
0 ignored issues
show
$this->option('delay') is of type string|array, but the function expects a integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
$this->option('memory') is of type string|array, but the function expects a integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
94
            $this->option('timeout'), $this->option('sleep'),
0 ignored issues
show
$this->option('timeout') is of type string|array, but the function expects a integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
$this->option('sleep') is of type string|array, but the function expects a integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
95
            $this->option('tries'), $this->option('force')
0 ignored issues
show
$this->option('tries') is of type string|array, but the function expects a integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
$this->option('force') is of type string|array, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
96
        );
97
    }
98
99
    /**
100
     * Set the options on the queue listener.
101
     *
102
     * @param  QueuePool  $pool
103
     * @return void
104
     */
105
    protected function setOutputHandler(QueuePool $pool)
106
    {
107
        $pool->setOutputHandler(function ($type, $line) {
108
            $this->output->write($line);
109
        });
110
    }
111
}
112