Issues (243)

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/DI/TInjectable.php (2 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 Anax\DI;
4
5
/**
6
 * Interface to implement for DI aware services to let them know of the current $di
7
 *
8
 */
9
trait TInjectable
10
{
11
12
    /**
13
     * Properties
14
     */
15
    protected $di; // the service container
16
17
18
19
    /**
20
     * Set the service container to use
21
     *
22
     * @param object $di a service container
23
     *
24
     * @return $this
25
     */
26
    public function setDI($di)
27
    {
28
        $this->di = $di;
29
    }
30
31
32
    /**
33
     * Magic method to get and create services.
34
     * When created it is also stored as a parameter of this object.
35
     *
36
     * @param string $service name of class property not existing.
37
     * 
38
     * @return object as the service requested.
39
     * @throws \Exception
40
     */
41 View Code Duplication
    public function __get($service)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
42
    {
43
        if (!$this->di) {
44
            throw new \Exception(
45
                'In trait TInjectable used by class ' . __CLASS__ . '. You are trying to get
46
                message, code a property from $this->di, but $this->di is not set. Did you
47
                forget to call setDI()?'
48
            );
49
        }
50
51
        try {
52
53
            $this->$service = $this->di->get($service);
54
            return $this->$service;
55
56
        } catch (\Exception $e) {
57
            throw new \Exception(
58
                'In trait TInjectable used by class ' . __CLASS__ . '. You are trying to get
59
                a property (service) "' . $service . '" from $this->di, but the service is not
60
                set in $this->di. Did you misspell the service you are trying to reach or did
61
                you forget to load it into the $di container?'
62
                . $e->getMessage()
63
            );
64
        }
65
    }
66
67
68
    /**
69
     * Magic method to get and create services as a method call.
70
     * When created it is also stored as a parameter of this object.
71
     *
72
     * @param string $service name of class property not existing.
73
     * @param array  $arguments Additional arguments to sen to the method (NOT IMPLEMENTED).
74
     *
75
     * @return object as the service requested.
76
     * @throws \Exception
77
     */
78 View Code Duplication
    public function __call($service, $arguments = [])
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
79
    {
80
        if (!$this->di) {
81
            throw new \Exception(
82
                'In trait TInjectable used by class ' . __CLASS__ . '. You are trying to call a
83
                method in $this->di, but $this->di is not set. Did you forget to call setDI()?'
84
            );
85
        }
86
87
        try {
88
89
            $this->$service = $this->di->get($service);
90
            return $this->$service;
91
92
        } catch (\Exception $e) {
93
            throw new \Exception(
94
                'In trait TInjectable used by class ' . __CLASS__ . '. You are trying to get a
95
                method (service) "' . $service . '" from $this->di, but the service is not set
96
                in $this->di. Did you misspell the service you are trying to reach or did you
97
                forget to load it into the $di container? '
98
                . $e->getMessage()
99
            );
100
        }
101
    }
102
}
103