Issues (49)

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/Adapter/Apcu.php (8 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
 * Part of the Joomla Framework Cache Package
4
 *
5
 * @copyright  Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
6
 * @license    GNU General Public License version 2 or later; see LICENSE
7
 */
8
9
namespace Joomla\Cache\Adapter;
10
11
use Joomla\Cache\AbstractCacheItemPool;
12
use Joomla\Cache\Item\HasExpirationDateInterface;
13
use Joomla\Cache\Item\Item;
14
use Psr\Cache\CacheItemInterface;
15
16
/**
17
 * APCu cache driver for the Joomla Framework.
18
 *
19
 * @since       __DEPLOY_VERSION__
20
 * @deprecated  The joomla/cache package is deprecated
21
 */
22
class Apcu extends AbstractCacheItemPool
0 ignored issues
show
Deprecated Code introduced by
The class Joomla\Cache\AbstractCacheItemPool has been deprecated with message: The joomla/cache package is deprecated

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
23
{
24
	/**
25
	 * This will wipe out the entire cache's keys
26
	 *
27
	 * @return  boolean  True if the pool was successfully cleared. False if there was an error.
28
	 *
29
	 * @since   __DEPLOY_VERSION__
30
	 */
31
	public function clear()
32
	{
33
		return apcu_clear_cache();
34
	}
35
36
	/**
37
	 * Returns a Cache Item representing the specified key.
38
	 *
39
	 * @param   string  $key  The key for which to return the corresponding Cache Item.
40
	 *
41
	 * @return  CacheItemInterface  The corresponding Cache Item.
42
	 *
43
	 * @since   __DEPLOY_VERSION__
44
	 */
45 View Code Duplication
	public function getItem($key)
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...
46
	{
47
		$success = false;
48
		$value = apcu_fetch($key, $success);
49
		$item = new Item($key);
0 ignored issues
show
Deprecated Code introduced by
The class Joomla\Cache\Item\Item has been deprecated with message: The joomla/cache package is deprecated

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
50
51
		if ($success)
52
		{
53
			$item->set($value);
54
		}
55
56
		return $item;
57
	}
58
59
	/**
60
	 * Returns a traversable set of cache items.
61
	 *
62
	 * @param   string[]  $keys  An indexed array of keys of items to retrieve.
63
	 *
64
	 * @return  array  A traversable collection of Cache Items keyed by the cache keys of each item.
65
	 *                 A Cache item will be returned for each key, even if that key is not found.
66
	 *
67
	 * @since   __DEPLOY_VERSION__
68
	 */
69
	public function getItems(array $keys = [])
70
	{
71
		$items   = [];
72
		$success = false;
73
		$values  = apcu_fetch($keys, $success);
74
75
		if ($success && is_array($values))
76
		{
77
			foreach ($keys as $key)
78
			{
79
				$items[$key] = new Item($key);
0 ignored issues
show
Deprecated Code introduced by
The class Joomla\Cache\Item\Item has been deprecated with message: The joomla/cache package is deprecated

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
80
81
				if (isset($values[$key]))
82
				{
83
					$items[$key]->set($values[$key]);
84
				}
85
			}
86
		}
87
88
		return $items;
89
	}
90
91
	/**
92
	 * Removes the item from the pool.
93
	 *
94
	 * @param   string  $key  The key to delete.
95
	 *
96
	 * @return  boolean  True if the item was successfully removed. False if there was an error.
97
	 *
98
	 * @since   __DEPLOY_VERSION__
99
	 */
100
	public function deleteItem($key)
101
	{
102
		if ($this->hasItem($key))
103
		{
104
			return apcu_delete($key);
0 ignored issues
show
Bug Compatibility introduced by
The expression apcu_delete($key); of type boolean|string[] adds the type string[] to the return on line 104 which is incompatible with the return type declared by the interface Psr\Cache\CacheItemPoolInterface::deleteItem of type boolean.
Loading history...
105
		}
106
107
		// If the item doesn't exist, no error
108
		return true;
109
	}
110
111
	/**
112
	 * Persists a cache item immediately.
113
	 *
114
	 * @param   CacheItemInterface  $item  The cache item to save.
115
	 *
116
	 * @return  boolean  True if the item was successfully persisted. False if there was an error.
117
	 *
118
	 * @since   __DEPLOY_VERSION__
119
	 */
120 View Code Duplication
	public function save(CacheItemInterface $item)
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...
121
	{
122
		// If we are able to find out when the item expires - find out. Else bail.
123
		if ($item instanceof HasExpirationDateInterface)
124
		{
125
			$ttl = $this->convertItemExpiryToSeconds($item);
126
		}
127
		else
128
		{
129
			$ttl = 0;
130
		}
131
132
		return apcu_store($item->getKey(), $item->get(), $ttl);
0 ignored issues
show
Bug Compatibility introduced by
The expression apcu_store($item->getKey(), $item->get(), $ttl); of type boolean|array adds the type array to the return on line 132 which is incompatible with the return type declared by the interface Psr\Cache\CacheItemPoolInterface::save of type boolean.
Loading history...
133
	}
134
135
	/**
136
	 * Confirms if the cache contains specified cache item.
137
	 *
138
	 * @param   string  $key  The key for which to check existence.
139
	 *
140
	 * @return  boolean  True if item exists in the cache, false otherwise.
141
	 *
142
	 * @since   __DEPLOY_VERSION__
143
	 */
144
	public function hasItem($key)
145
	{
146
		return apcu_exists($key);
0 ignored issues
show
Bug Compatibility introduced by
The expression apcu_exists($key); of type boolean|string[] adds the type string[] to the return on line 146 which is incompatible with the return type declared by the interface Psr\Cache\CacheItemPoolInterface::hasItem of type boolean.
Loading history...
147
	}
148
149
	/**
150
	 * Test to see if the CacheItemPoolInterface is available
151
	 *
152
	 * @return  boolean  True on success, false otherwise
153
	 *
154
	 * @since   __DEPLOY_VERSION__
155
	 */
156
	public static function isSupported(): bool
157
	{
158
		$supported = extension_loaded('apcu') && ini_get('apc.enabled');
159
160
		// If on the CLI interface, the `apc.enable_cli` option must also be enabled
161
		if ($supported && php_sapi_name() === 'cli')
162
		{
163
			$supported = ini_get('apc.enable_cli');
164
		}
165
166
		return (bool) $supported;
167
	}
168
}
169