Issues (24)

Security Analysis    not enabled

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/Util/BacksUpItems.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
4
namespace SmartWeb\ModuleTesting\Util;
5
6
use DeepCopy\DeepCopy;
7
use Illuminate\Support\Arr;
8
use Illuminate\Support\Collection;
9
use InvalidArgumentException;
10
use SmartWeb\ModuleTesting\Support\Concerns\MutatesAttributes;
11
use Traversable;
12
13
14
if (!function_exists('is_iterable')) {
15
    /**
16
     * true if a value is iterable and will be accepted by the iterable pseudo-type, false for other values.
17
     *
18
     * @param mixed $value
19
     *
20
     * @return bool
21
     *
22
     * @see  \is_iterable()
23
     * @link https://wiki.php.net/rfc/iterable
24
     */
25
    function is_iterable($value)
0 ignored issues
show
The function SmartWeb\ModuleTesting\Util\is_iterable() has been defined more than once; this definition is ignored, only the first definition in src/Helpers/helpers.php (L14-17) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
26
    {
27
        return (is_array($value) || ($value instanceof Traversable));
28
    }
29
}
30
31
32
/**
33
 * Trait BacksUpItems
34
 *
35
 * @package SmartWeb\ModuleTesting\Util
36
 */
37
trait BacksUpItems
38
{
39
    
40
    use MutatesAttributes;
41
    
42
    /**
43
     * @var Collection
44
     */
45
    protected $items;
46
    
47
    /**
48
     * @var Collection
49
     */
50
    private $itemsBackup;
51
    
52
    /**
53
     * @var DeepCopy
54
     */
55
    private $copier;
56
    
57
    /**
58
     * @ignore
59
     *
60
     * @param $name
61
     *
62
     * @return mixed
63
     */
64
    final public function __get($name)
65
    {
66
        if ($this->hasGetMutator($name)) {
67
            return $this->getMutatedAttribute($name);
68
        }
69
        
70
        return $this->items[$name];
71
    }
72
    
73
    /**
74
     * @ignore
75
     *
76
     * @param $name
77
     * @param $value
78
     */
79
    final public function __set($name, $value)
80
    {
81
        $this->items[$name] = $value;
82
    }
83
    
84
    /**
85
     * @param mixed[] ...$items
86
     */
87
    final protected function inject(...$items)
88
    {
89
        $this->items = new Collection();
90
        
91
        foreach ($items as $item) {
92
            if (is_iterable($item) && Arr::isAssoc($item)) {
93
                $this->items = $this->items->merge($item);
94
            } else {
95
                throw new InvalidArgumentException("\$items must be an associative array.");
96
            }
97
        }
98
        
99
        $this->itemsBackup = $this->items ?? new Collection();
100
    }
101
    
102
    final protected function backupItems()
103
    {
104
        $this->itemsBackup = $this->getCopier()->copy($this->items ?? new Collection());
105
    }
106
    
107
    final protected function restoreItems()
108
    {
109
        $this->items = $this->getCopier()->copy($this->itemsBackup);
110
        $this->itemsBackup = null;
111
    }
112
    
113
    /**
114
     * @return DeepCopy
115
     */
116
    private function getCopier() : DeepCopy
117
    {
118
        return ($this->copier = $this->copier ?? new DeepCopy(true))->skipUncloneable();
119
    }
120
}
121