Issues (265)

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/Dir.php (11 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 PHP\Wrappers;
4
5
use Directory;
6
7
/**
8
 * Class Dir
9
 *
10
 * @package PHP\Wrappers
11
 * @author  Aurimas Niekis <[email protected]>
12
 */
13
class Dir
14
{
15
    /**
16
     * Change directory
17
     *
18
     * @param string $directory The new current directory
19
     *
20
     * @return bool
21
     */
22
    public function chDir(string $directory) : bool
23
    {
24
        return chdir($directory);
25
    }
26
27
    /**
28
     * Change the root directory
29
     *
30
     * @param string $directory The path to change the root directory to.
31
     *
32
     * @return bool
33
     */
34
    public function chroot(string $directory) : bool
35
    {
36
        return chroot($directory);
37
    }
38
39
    /**
40
     * Close directory handle
41
     *
42
     * @param resource $dirHandle The directory handle resource previously opened
43
     *                            with opendir. If the directory handle is
44
     *                            not specified, the last link opened by opendir
45
     *                            is assumed.
46
     *
47
     * @return void
48
     */
49
    public function closeDir($dirHandle = null)
0 ignored issues
show
The parameter $dirHandle 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...
50
    {
51
        call_user_func_array('closedir', func_get_args());
52
    }
53
54
    /**
55
     * Return an instance of the Directory class
56
     *
57
     * @param string   $directory
58
     * @param resource $context
59
     *
60
     * @return Directory
61
     */
62
    public function dir(string $directory, $context = null) : Directory
0 ignored issues
show
The parameter $directory 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...
The parameter $context 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...
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
63
    {
64
        return call_user_func_array('dir', func_get_args());
65
    }
66
67
    /**
68
     * Gets the current working directory
69
     *
70
     * @return string
71
     */
72
    public function getcwd() : string
73
    {
74
        return getcwd();
75
    }
76
77
    /**
78
     * Open directory handle
79
     *
80
     * @param string   $path    The directory path that is to be opened
81
     * @param resource $context For a description of the context parameter,
82
     *                          refer to the streams section of
83
     *                          the manual.
84
     *
85
     * @return resource
86
     */
87
    public function openDir(string $path, $context = null)
0 ignored issues
show
The parameter $path 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...
The parameter $context 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...
88
    {
89
        return call_user_func_array('opendir', func_get_args());
90
    }
91
92
    /**
93
     * Read entry from directory handle
94
     *
95
     * @param resource $dirHandle The directory handle resource previously opened
96
     *                            with opendir. If the directory handle is
97
     *                            not specified, the last link opened by opendir
98
     *                            is assumed.
99
     *
100
     * @return string
101
     */
102
    public function readdDr($dirHandle = null) : string
0 ignored issues
show
The parameter $dirHandle 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...
103
    {
104
        return call_user_func_array('readdir', func_get_args());
105
    }
106
107
    /**
108
     * Rewind directory handle
109
     *
110
     * @param resource $dirHandle The directory handle resource previously opened
111
     *                            with opendir. If the directory handle is
112
     *                            not specified, the last link opened by opendir
113
     *                            is assumed.
114
     *
115
     * @return void
116
     */
117
    public function rewindDir($dirHandle = null)
0 ignored issues
show
The parameter $dirHandle 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...
118
    {
119
        call_user_func_array('rewinddir', func_get_args());
120
    }
121
122
    /**
123
     * List files and directories inside the specified path
124
     *
125
     * @param string   $directory    The directory that will be scanned.
126
     * @param int      $sortingOrder By default, the sorted order is alphabetical in ascending order.  If
127
     *                               the optional sorting_order is set to
128
     *                               SCANDIR_SORT_DESCENDING, then the sort order is
129
     *                               alphabetical in descending order. If it is set to
130
     *                               SCANDIR_SORT_NONE then the result is unsorted.
131
     * @param resource $context      For a description of the context parameter,
132
     *                               refer to the streams section of
133
     *                               the manual.
134
     *
135
     * @return array
136
     */
137
    public function scanDir(string $directory, int $sortingOrder = null, $context = null) : array
0 ignored issues
show
The parameter $directory 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...
The parameter $sortingOrder 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...
The parameter $context 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...
138
    {
139
        return call_user_func_array('scandir', func_get_args());
140
    }
141
142
}
143
144