Conditions | 5 |
Paths | 4 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
5 | public function updateEnabled(&$enabled) |
||
6 | { |
||
7 | // Disable caching for this request if a user is logged in |
||
8 | if (Member::currentUserID()) { |
||
9 | $enabled = false; |
||
10 | } |
||
11 | |||
12 | // Disable caching for this request if in dev mode |
||
13 | elseif (Director::isDev()) { |
||
14 | $enabled = false; |
||
15 | } |
||
16 | |||
17 | // Disable caching if the request is in dev mode |
||
18 | else { |
||
19 | $session = Session::get_all(); |
||
20 | if ($session && count($session)) { |
||
|
|||
21 | $enabled = false; |
||
22 | } |
||
23 | } |
||
24 | } |
||
25 | |||
36 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.