The expression $dir of type null|string is loosely compared to false; this is ambiguous if the string can be empty. You might want to explicitly use === null instead.
In PHP, under loose comparison (like ==, or !=, or switch conditions),
values of different types might be equal.
For string values, the empty string '' is a special case, in particular
the following results might be unexpected:
''==false// true''==null// true'ab'==false// false'ab'==null// false// It is often better to use strict comparison''===false// false''===null// false
Loading history...
18
$dir = sys_get_temp_dir();
19
}
20
$dir = rtrim($dir, '/');
21
22
$files = [];
23
24
foreach ($this->data['Labels'] as $label) {
25
$decoded = base64_decode($label['Content']);
26
27
if ($decoded === false) {
28
throw new InvalidBase64Exception('An error occurred during the base64_decode');
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: