This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /********************************************************************************* |
||
3 | * SugarCRM Community Edition is a customer relationship management program developed by |
||
4 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
||
5 | |||
6 | * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd. |
||
7 | * Copyright (C) 2011 - 2014 Salesagility Ltd. |
||
8 | * |
||
9 | * This program is free software; you can redistribute it and/or modify it under |
||
10 | * the terms of the GNU Affero General Public License version 3 as published by the |
||
11 | * Free Software Foundation with the addition of the following permission added |
||
12 | * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK |
||
13 | * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY |
||
14 | * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. |
||
15 | * |
||
16 | * This program is distributed in the hope that it will be useful, but WITHOUT |
||
17 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
||
18 | * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
||
19 | * details. |
||
20 | * |
||
21 | * You should have received a copy of the GNU Affero General Public License along with |
||
22 | * this program; if not, see http://www.gnu.org/licenses or write to the Free |
||
23 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
||
24 | * 02110-1301 USA. |
||
25 | * |
||
26 | * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, |
||
27 | * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected]. |
||
28 | * |
||
29 | * The interactive user interfaces in modified source and object code versions |
||
30 | * of this program must display Appropriate Legal Notices, as required under |
||
31 | * Section 5 of the GNU Affero General Public License version 3. |
||
32 | * |
||
33 | * In accordance with Section 7(b) of the GNU Affero General Public License version 3, |
||
34 | * these Appropriate Legal Notices must retain the display of the "Powered by |
||
35 | * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not |
||
36 | * reasonably feasible for technical reasons, the Appropriate Legal Notices must |
||
37 | * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
||
38 | ********************************************************************************/ |
||
39 | |||
40 | |||
41 | require_once('include/SugarCache/SugarCacheAbstract.php'); |
||
42 | |||
43 | class SugarCacheFile extends SugarCacheAbstract |
||
44 | { |
||
45 | /** |
||
46 | * @var path and file which will store the cache used for this backend |
||
47 | */ |
||
48 | protected $_cacheFileName = 'externalCache.php'; |
||
49 | |||
50 | /** |
||
51 | * @var bool true if the cache has changed and needs written to disk |
||
52 | */ |
||
53 | protected $_cacheChanged = false; |
||
54 | |||
55 | /** |
||
56 | * @see SugarCacheAbstract::$_priority |
||
57 | */ |
||
58 | protected $_priority = 990; |
||
59 | |||
60 | /** |
||
61 | * @see SugarCacheAbstract::useBackend() |
||
62 | */ |
||
63 | public function useBackend() |
||
64 | { |
||
65 | if ( !parent::useBackend() ) |
||
66 | return false; |
||
67 | |||
68 | if ( !empty($GLOBALS['sugar_config']['external_cache_enabled_file']) ) |
||
69 | return true; |
||
70 | |||
71 | return false; |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * @see SugarCacheAbstract::__construct() |
||
76 | * |
||
77 | * For this backend, we'll read from the SugarCacheFile::_cacheFileName file into |
||
78 | * the SugarCacheFile::$localCache array. |
||
79 | */ |
||
80 | public function __construct() |
||
81 | { |
||
82 | parent::__construct(); |
||
83 | |||
84 | if ( isset($GLOBALS['sugar_config']['external_cache_filename']) ) |
||
85 | $this->_cacheFileName = $GLOBALS['sugar_config']['external_cache_filename']; |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * @see SugarCacheAbstract::__destruct() |
||
90 | * |
||
91 | * For this backend, we'll write the SugarCacheFile::$localCache array serialized out to a file |
||
92 | */ |
||
93 | public function __destruct() |
||
94 | { |
||
95 | parent::__destruct(); |
||
96 | |||
97 | if ( $this->_cacheChanged ) |
||
98 | sugar_file_put_contents(sugar_cached($this->_cacheFileName), serialize($this->_localStore)); |
||
99 | } |
||
100 | |||
101 | /** |
||
102 | * This is needed to prevent unserialize vulnerability |
||
103 | */ |
||
104 | public function __wakeup() |
||
105 | { |
||
106 | // clean all properties |
||
107 | foreach(get_object_vars($this) as $k => $v) { |
||
108 | $this->$k = null; |
||
109 | } |
||
110 | throw new Exception("Not a serializable object"); |
||
111 | } |
||
112 | |||
113 | /** |
||
114 | * @see SugarCacheAbstract::_setExternal() |
||
115 | * |
||
116 | * Does nothing; we write to cache on destroy |
||
117 | */ |
||
118 | protected function _setExternal( |
||
119 | $key, |
||
120 | $value |
||
121 | ) |
||
122 | { |
||
123 | $this->_cacheChanged = true; |
||
124 | } |
||
125 | |||
126 | /** |
||
127 | * @see SugarCacheAbstract::_getExternal() |
||
128 | */ |
||
129 | protected function _getExternal( |
||
130 | $key |
||
131 | ) |
||
132 | { |
||
133 | // load up the external cache file |
||
134 | if ( sugar_is_file($cachedfile = sugar_cached($this->_cacheFileName))) |
||
135 | $this->localCache = unserialize(file_get_contents($cachedfile)); |
||
0 ignored issues
–
show
|
|||
136 | |||
137 | if ( isset($this->_localStore[$key]) ) |
||
138 | return $this->_localStore[$key]; |
||
139 | |||
140 | return null; |
||
141 | } |
||
142 | |||
143 | /** |
||
144 | * @see SugarCacheAbstract::_clearExternal() |
||
145 | * |
||
146 | * Does nothing; we write to cache on destroy |
||
147 | */ |
||
148 | protected function _clearExternal( |
||
149 | $key |
||
150 | ) |
||
151 | { |
||
152 | $this->_cacheChanged = true; |
||
153 | } |
||
154 | |||
155 | /** |
||
156 | * @see SugarCacheAbstract::_resetExternal() |
||
157 | * |
||
158 | * Does nothing; we write to cache on destroy |
||
159 | */ |
||
160 | protected function _resetExternal() |
||
161 | { |
||
162 | $this->_cacheChanged = true; |
||
163 | } |
||
164 | } |
||
165 |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.