GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (25)

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/MultiRequest.php (2 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 MultiHttp;
4
5
use MultiHttp\Exception\InvalidArgumentException;
6
7
/**
8
 *
9
 * @author  [email protected] [email protected]
10
 * Date: 2017/6/9
11
 * Time: 15:09
12
 * @version $Id: $
13
 * @since 1.0
14
 * @copyright Sina Corp.
15
 */
16
class MultiRequest
17
{
18
    /**
19
     * @var [Response]
20
     */
21
    protected static $requestPool = array();
22
    protected static $multiHandler;
23
    protected $defaultOptions = array();
24
    private static $instance;
25
    protected static $loggerHandler;
26
    /**
27
     * MultiRequest constructor.
28
     */
29 1
    protected function __construct()
30
    {
31 1
    }
32
33
    /**
34
     * @return MultiRequest
35
     */
36 2
    public static function create()
37
    {
38 2
        if (!(self::$instance instanceof self)) {
39 1
            self::$instance = new self;
40 1
        }
41 2
        self::prepare();
42 2
        return self::$instance;
43
    }
44
45
    /**
46
     * @param array $options
47
     * @return $this
48
     */
49 1
    public function setDefaults(array $options = array()){
50 1
        $this->defaultOptions = $options;
51 1
        return $this;
52
    }
53 2
    protected static function prepare()
54
    {
55 2
        self::$multiHandler = curl_multi_init();
56 2
    }
57
58
    /**
59
     * @param $method
60
     * @param $uri
61
     * @param $payload
62
     * @param array $options
63
     * @return $this
64
     */
65 2 View Code Duplication
    public function add($method, $uri, $payload, array $options = array())
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
66
    {
67
        $options = array(
68 2
                'method' => $method,
69 2
                'url' => $uri,
70 2
                'data' => $payload,
71 2
            ) + $options;
72 2
        $this->addOptions(array($options));
73 2
        return $this;
74
    }
75
76
    /**
77
     * @param array $URLOptions
78
     * example: array(array('url'=>'http://localhost:9999/','timeout'=>1, 'method'=>'POST', 'data'=>'aa=bb&c=d'))
79
     * @return $this
80
     */
81 2
    public function addOptions(array $URLOptions)
82
    {
83 2
        foreach ($URLOptions as $options) {
84 2
            $options = $options + $this->defaultOptions;
85 2
            $request = Request::create()->addOptions($options)->applyOptions();
86 2
            if (isset($options['callback'])) {
87 2
                $request->onEnd($options['callback']);
88 2
            }
89 2
            $this->import($request);
90 2
        }
91 2
        return $this;
92
    }
93
94
    /**
95
     * @param Request $request
96
     * @return $this
97
     */
98 2
    public function import(Request $request)
99
    {
100 2
        if (!is_resource($request->curlHandle)) {
101
            throw new InvalidArgumentException('Request curl handle is not initialized');
102
        }
103 2
        curl_multi_add_handle(self::$multiHandler, $request->curlHandle);
104 2
        self::$requestPool[] = $request;
105 2
        return $this;
106
    }
107
108
    /**
109
     * @return array(Response)
0 ignored issues
show
The doc-type array(Response) could not be parsed: Expected "|" or "end of type", but got "(" at position 5. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
110
     */
111 2
    public function sendAll()
112
    {
113 2
        $sleepTime = 1000;//microsecond, prevent  CPU 100%
114
        do {
115 2
            curl_multi_exec(self::$multiHandler, $active);
116
            // bug in PHP 5.3.18+ where curl_multi_select can return -1
117
            // https://bugs.php.net/bug.php?id=63411
118 2
            if (curl_multi_select(self::$multiHandler) == -1) {
119 2
                usleep($sleepTime);
120 2
            }
121 2
            usleep($sleepTime);
122 2
        } while ($active);
123 2
        $return = array();
124 2
        foreach (self::$requestPool as $request) {
125 2
            $return[] = $request->send(true);
126 2
            curl_multi_remove_handle(self::$multiHandler, $request->curlHandle);
127 2
            curl_close($request->curlHandle);
128 2
        }
129 2
        curl_multi_close(self::$multiHandler);
130 2
        self::$requestPool = array();
131 2
        self::$multiHandler = null;
132 2
        return $return;
133
    }
134
135
}
136