Issues (4)

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

Severity

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 Colada
4
{
5
    use Colada\X\LazyObjectProxy;
6
    use InvalidArgumentException;
7
8
    if (!function_exists('\\Colada\\x')) {
9
        /**
10
         * Represents future value (useful for processing collection elements with {@see \Colada\Collection::mapBy()}, for example).
11
         *
12
         * Example:
13
         * <code>
14
         * $users->acceptBy(\Colada\x()->isActive());
15
         * </code>
16
         *
17
         * And example for PHP 5.6:
18
         * <code>
19
         * use function Colada\x;
20
         *
21
         * $users->acceptBy(x()->isActive());
22
         * </code>
23
         *
24
         * vs.
25
         *
26
         * <code>
27
         * $users->acceptBy(
28
         *     function($user) { return $user->isActive(); }
29
         * );
30
         * </code>
31
         *
32
         * @api
33
         *
34
         * @param null|string $t Return class type hint (for PHPStorm, see .phpstorm.meta.php in the package's root)
35
         *
36
         * @return callable
37
         */
38
        function x($t = null)
0 ignored issues
show
The parameter $t is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
39
        {
40
            return new LazyObjectProxy();
41
        }
42
    }
43
44
    if (!function_exists('\\Colada\\lazy')) {
45
        /**
46
         * Wraps object to proxy, that collects all actions and plays them only when asked.
47
         *
48
         * Example:
49
         * <code>
50
         * use function Colada\lazy;
51
         *
52
         * $value = lazy(new \ArrayObject([1, 2, 3]))->count();
53
         *
54
         * echo $value(); // Will print "3".
55
         * </code>
56
         *
57
         * @api
58
         *
59
         * @param mixed $object
60
         *
61
         * @return callable
62
         */
63
        function lazy($object)
64
        {
65
            if (!is_object($object)) {
66
                throw new InvalidArgumentException('Only objects can be wrapped.');
67
            }
68
69
            return new LazyObjectProxy(function () use ($object) {
70
                return $object;
71
            });
72
        }
73
    }
74
}
75
76
namespace Colada\X
77
{
78
    use ArrayAccess;
79
    use Closure;
80
    use ReflectionFunction;
81
    use ReflectionMethod;
82
    use ReflectionObject;
83
84
    if (!function_exists('\\Colada\\X\\id')) {
85
        /**
86
         * @param $value
87
         *
88
         * @return mixed
89
         */
90
        function id($value)
91
        {
92
            return $value;
93
        }
94
    }
95
96
    if (!function_exists('\\Colada\\X\\is_array_accessible')) {
97
        /**
98
         * @param mixed $value
99
         *
100
         * @return bool
101
         */
102
        function is_array_accessible($value)
103
        {
104
            return is_array($value) || (is_object($value) && ($value instanceof ArrayAccess));
105
        }
106
    }
107
108
    if (!function_exists('\\Colada\\X\\as_closure')) {
109
        /**
110
         * Create \Closure view of given callable
111
         *
112
         * Closure style calling can speed up callback (see http://php.net/manual/en/reflectionfunction.getclosure.php
113
         * for details).
114
         *
115
         * @see https://wiki.php.net/rfc/closurefromcallable
116
         *
117
         * @param callable $callback
118
         *
119
         * @return Closure
120
         */
121
        function as_closure(callable $callback)
122
        {
123
            if (method_exists('Closure','fromCallable')) {
124
                // Available as of PHP 7.1
125
                $closure = Closure::fromCallable($callback);
126
            } else {
127
                if (is_object($callback) && ($callback instanceof Closure)) {
128
                    $closure = $callback;
129
                } elseif (is_object($callback)) {
130
                    // Object with __invoke().
131
                    $closure = (new ReflectionObject($callback))->getMethod('__invoke')->getClosure($callback);
132
                } elseif (is_array($callback) && is_object($callback[0])) {
133
                    // Object method.
134
                    $closure = (new ReflectionMethod($callback[0], $callback[1]))->getClosure($callback[0]);
135
                } elseif (is_array($callback)) {
136
                    // Static method.
137
                    $closure = (new ReflectionMethod($callback[0], $callback[1]))->getClosure();
138
                } else {
139
                    // Function name as a string.
140
                    $closure = (new ReflectionFunction($callback))->getClosure();
141
                }
142
            }
143
144
            return $closure;
145
        }
146
    }
147
}
148