Issues (7)

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.

code/api/OneCallObjectCacher.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
4
class OneCallObjectCacher extends Object
5
{
6
7
    /**
8
     *
9
     * @var array
10
     */
11
    private static $_object_store = array();
12
13
    /**
14
     *
15
     * @var array
16
     */
17
    private static $_reference_to_full_key = array();
18
19
20
    public static function get_one($callerClass, $filter = "", $cache = true, $orderby = "")
0 ignored issues
show
The parameter $callerClass 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 $filter 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 $cache 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 $orderby 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...
21
    {
22
    }
23
24
    /**
25
     *
26
     * @var array
27
     */
28
    private static $_list_cache = array();
29
30
31
    public static function clear_all()
32
    {
33
        self::$_object_store = array();
34
        self::$_reference_to_full_key = array();
35
        self::$_list_cache = array();
36
    }
37
38
39
    public static function clear_objects()
40
    {
41
        self::$_object_store = array();
42
        self::$_reference_to_full_key = array();
43
    }
44
45
    public static function clear_lists()
46
    {
47
        self::$_list_cache = array();
48
    }
49
50
51
    /**
52
     * stores any dataobject
53
     * @param DataObject
54
     *
55
     * @return DataObject
56
     */
57
    public static function store_object($object, $key = null)
58
    {
59
        $originalKey = $key;
60
        $key .= '_'.$object->ClassName.'_'.$object->ID;
61
        self::$_reference_to_full_key[$originalKey] = $key;
62
        self::$_object_store[$key] = $object;
63
64
        return $object;
65
    }
66
67
    /**
68
     * stores any dataobject
69
     * @param string $key
70
     * @param string $className (optional)
71
     * @param int $id (optional)
72
     *
73
     * @return DataObject
74
     */
75
    public static function retrieve_object($key, $className = '', $id = 0)
76
    {
77
        $originalKey = $key;
78
        $key .= '_'.$className.'_'.$id;
79
        if (isset(self::$_object_store[$key])) {
80
        } else {
81
            if (isset(self::$_object_store[self::$_reference_to_full_key[$originalKey]])) {
82
                return self::$_object_store[self::$_reference_to_full_key[$originalKey]];
83
            }
84
        }
85
86
        return $object;
0 ignored issues
show
The variable $object does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
87
    }
88
89
    /**
90
     * clears all the references to one object...
91
     * returns true if found and false it not found ...
92
     *
93
     * @param  string $className
94
     * @param  int    $id
95
     *
96
     * @return bool
97
     */
98
    public static function clear_one_object($className, $id)
99
    {
100
        $keyEnd = '_'.$className.'_'.$id;
101
        $keyEndLength = strlen($keyEnd);
102
        foreach (self::$_object_store as $key => $ignore) {
103
            if (substr($key, -$keyEndLength) === $keyEnd) {
104
                $referenceKey = subst($key, 0, strlen($key) - $keyEndLength);
105
                unset(self::$_object_store[$key]);
106
                unset(self::$_reference_to_full_key[$referenceKey]);
107
                return true;
108
            }
109
        }
110
111
        return false;
112
    }
113
114
    /**
115
     * return a data list
116
     * @param SS_List
117
     * @param string $key
118
     *
119
     * @return SS_List
120
     */
121
    public static function store_list($dataList, $key)
122
    {
123
        self::$_list_cache[$key] = $dataList->column('ID');
124
125
        return $dataList;
126
    }
127
128
    /**
129
     *
130
     * @param  string $key
131
     *
132
     * @return array
133
     */
134
    public static function retrieve_list($key)
135
    {
136
        return self::$_list_cache[$key];
137
    }
138
}
139