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 (1)

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/Utils.php (1 issue)

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 PHP\Math\BigNumber;
4
5
use InvalidArgumentException;
6
use RuntimeException;
7
8
/**
9
 * A utility class.
10
 */
11
final class Utils
12
{
13
    const BASE32_ALPHABET = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
14
15
    /**
16
     * Gets the plain number from the given input. Converts a BigNumber to a string.
17
     *
18
     * @param string|int|BigNumber $number The number to convert.
19
     * @return string
20
     */
21 17
    public static function getPlainNumber($number)
22
    {
23 17
        if ($number instanceof BigNumber) {
24 14
            $number = $number->getValue();
25 14
        }
26
27 17
        return (string)$number;
28
    }
29
30
    /**
31
     * Converts the provided number from an arbitrary base to to a base 10 number.
32
     *
33
     * @param string|int|BigNumber $number The number to convert.
34
     * @param int $fromBase The base to convert the number from.
35
     * @return string
36
     * @throws InvalidArgumentException Thrown when the base is out of reach.
37
     */
38 10
    public static function convertToBase10($number, $fromBase)
39
    {
40 10
        $number = (string)ceil(static::getPlainNumber($number));
41
42 10
        if ($fromBase == 10) {
43 2
            return $number;
44 8
        } elseif ($fromBase < 2 || $fromBase > 32) {
45 2
            throw new InvalidArgumentException(sprintf(
46 2
                'Base %d is unsupported, should be between 2 and 32.',
47
                $fromBase
48 2
            ));
49
        }
50
51 6
        $result = '0';
52 6
        $chars = self::BASE32_ALPHABET;
53
54 6
        for ($i = 0, $len = strlen($number); $i < $len; $i++) {
55 6
            $index = strpos($chars, $number[$i]);
56
57 6
            if ($index >= $fromBase) {
58 2
                throw new RuntimeException(sprintf(
59 2
                    'The digit %s in the number %s is an invalid digit for base-%s.',
60 2
                    $chars[$index],
61 2
                    $number,
62
                    $fromBase
63 2
                ));
64
            }
65
66 4
            $result = bcmul($result, $fromBase);
67 4
            $result = bcadd($result, strpos($chars, $number[$i]));
68 4
        }
69
70 4
        return $result;
71
    }
72
73
    /**
74
     * Converts the provided number from an arbitrary base to another arbitrary base (from 2 to 36).
75
     *
76
     * @param string|int|BigNumber $number The number to convert.
77
     * @param int $fromBase The base to convert the number from.
78
     * @param int $toBase The base to convert the number to.
79
     * @return string
80
     * @throws InvalidArgumentException Thrown when the base is out of reach.
81
     */
82 6
    public static function convertBase($number, $fromBase, $toBase)
83
    {
84 6
        $number = static::getPlainNumber($number);
85
86 6
        if ($fromBase == $toBase) {
87 1
            return $number;
88
        }
89
90 5
        if ($fromBase < 2 || $fromBase > 32) {
91 1
            throw new InvalidArgumentException(sprintf(
92 1
                'Base %d is unsupported, should be between 2 and 32.',
93
                $fromBase
94 1
            ));
95
        }
96
97 4
        if ($toBase < 2 || $toBase > 32) {
98 1
            throw new InvalidArgumentException(sprintf(
99 1
                'Base %d is unsupported, should be between 2 and 32.',
100
                $toBase
101 1
            ));
102
        }
103
104
        // Save the sign and trim it off so we can easier calculate the number:
105 3
        $sign = (strpos($number, '-') === 0) ? '-' : '';
106 3
        $number = ltrim($number, '-+');
107
108
        // First we convert the number to a decimal value:
109 3
        $decimal = static::convertToBase10($number, $fromBase);
110 2
        if ($toBase == 10) {
111 1
            return $decimal;
112
        }
113
114
        // Next we convert to the correct base:
115 1
        $result = '';
116 1
        $chars = self::BASE32_ALPHABET;
117
118
        do {
119 1
            $remainder = bcmod($decimal, $toBase);
120 1
            $decimal = bcdiv($decimal, $toBase);
121 1
            $result = $chars[$remainder] . $result;
122 1
        } while (bccomp($decimal, '0'));
123
124 1
        return $sign . ltrim($result, '0');
125
    }
126
127
    /**
128
     * Multiplies the two given numbers.
129
     *
130
     * @param BigNumber $lft The left number.
131
     * @param BigNumber $rgt The right number.
132
     * @param int $scale The scale of the calculated number.
133
     * @param bool $mutable Whether or not the result is mutable.
134
     * @return BigNumber
135
     */
136 4
    public static function multiply(BigNumber $lft, BigNumber $rgt, $scale = 10, $mutable = true)
137
    {
138 4
        $bigNumber = new BigNumber($lft, $scale, $mutable);
0 ignored issues
show
$lft is of type object<PHP\Math\BigNumber\BigNumber>, 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...
139
140 4
        return $bigNumber->multiply($rgt);
141
    }
142
}
143