| 1 | <?php |
||
| 21 | class PermissionsTask extends AbstractTypo3Task |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * name |
||
| 25 | * |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | protected $name = 'permissions'; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * description |
||
| 32 | * |
||
| 33 | * @var string |
||
| 34 | */ |
||
| 35 | protected $description = '[TYPO3] TYPO3 permissions task'; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * permissions |
||
| 39 | * |
||
| 40 | * @var array |
||
| 41 | */ |
||
| 42 | protected $permissions = [ |
||
| 43 | '/typo3conf/PackageStates.php' => 2775, |
||
| 44 | '/typo3conf/LocalConfiguration.php' => 2775, |
||
| 45 | ]; |
||
| 46 | |||
| 47 | /** |
||
| 48 | * execute |
||
| 49 | * |
||
| 50 | * @return bool |
||
| 51 | */ |
||
| 52 | public function execute(): bool |
||
| 62 | } |
||
| 63 |
If you define a variable conditionally, it can happen that it is not defined for all execution paths.
Let’s take a look at an example:
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.
Available Fixes
Check for existence of the variable explicitly:
Define a default value for the variable:
Add a value for the missing path: