| 1 | <?php |
||
| 5 | class CsrfHelper |
||
| 6 | { |
||
| 7 | const TOKEN_NAME = 'csrftoken'; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * Get a CSRF token from the given cookie file |
||
| 11 | * |
||
| 12 | * @param string $file |
||
| 13 | * @return string |
||
| 14 | */ |
||
| 15 | public static function getTokenFromFile($file) |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @param string $line |
||
| 33 | * @return bool |
||
| 34 | */ |
||
| 35 | protected static function _parseLineForToken($line) |
||
| 48 | } |
||
| 49 |
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.