Issues (287)

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.

NamingConventions/ValidFileNameSniff.php (5 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
 * CodeIgniter_Sniffs_NamingConventions_ValidFileNameSniff.
4
 *
5
 * PHP version 5
6
 *
7
 * @category  PHP
8
 * @package   PHP_CodeSniffer
9
 * @author    Thomas Ernest <[email protected]>
10
 * @copyright 2011 Thomas Ernest
11
 * @license   http://thomas.ernest.fr/developement/php_cs/licence GNU General Public License
12
 * @link      http://pear.php.net/package/PHP_CodeSniffer
13
 */
14
15
/**
16
 * CodeIgniter_Sniffs_NamingConventions_ValidFileNameSniff.
17
 *
18
 * Tests that the file name matchs the name of the class  that it contains in lower case.
19
 *
20
 * @category  PHP
21
 * @package   PHP_CodeSniffer
22
 * @author    Thomas Ernest <[email protected]>
23
 * @copyright 2011 Thomas Ernest
24
 * @license   http://thomas.ernest.fr/developement/php_cs/licence GNU General Public License
25
 * @link      http://pear.php.net/package/PHP_CodeSniffer
26
 */
27
28
namespace CodeIgniter\Sniffs\NamingConventions;
29
30
use PHP_CodeSniffer\Sniffs\Sniff;
31
use PHP_CodeSniffer\Files\File;
32
33
class ValidFileNameSniff implements Sniff
34
{
35
    /**
36
     * Returns an array of tokens this test wants to listen for.
37
     *
38
     * @return array
39
     */
40
    public function register()
41
    {
42
        return array(
43
            T_CLASS,
44
            T_INTERFACE,
45
        );
46
    }//end register()
47
48
49
    /**
50
     * Processes this test, when one of its tokens is encountered.
51
     *
52
     * @param File $phpcsFile The file being scanned.
53
     * @param int                  $stackPtr  The position of the current token in the
54
     *                                        stack passed in $tokens.
55
     *
56
     * @return void
57
     */
58
    public function process(File $phpcsFile, $stackPtr)
59
    {
60
        $tokens = $phpcsFile->getTokens();
61
        // computes the expected filename based on the name of the class or interface that it contains.
62
        $decNamePtr = $phpcsFile->findNext(T_STRING, $stackPtr);
63
        $decName = $tokens[$decNamePtr]['content'];
64
        $expectedFileName = strtolower($decName);
65
        // extracts filename without extension from its path.
66
        $fullPath = $phpcsFile->getFilename();
67
        $fileNameAndExt = basename($fullPath);
68
        $fileName = substr($fileNameAndExt, 0, strrpos($fileNameAndExt, '.'));
69
70
        if ($expectedFileName !== $fileName) {
71
            $errorTemplate = 'Filename "%s" doesn\'t match the name of the %s that it contains "%s" in lower case. "%s" was expected.';
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 135 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
72
            $errorMessage = sprintf(
73
                $errorTemplate,
74
                $fileName,
75
                strtolower($tokens[$stackPtr]['content']), // class or interface
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
76
                $decName,
77
                $expectedFileName
78
            );
79
            $phpcsFile->addError($errorMessage, 0);
0 ignored issues
show
The call to addError() misses a required argument $code.

This check looks for function calls that miss required arguments.

Loading history...
80
        }
81
    }//end process()
82
}//end class
83
84
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
85