Let's consider the expression:
$_REQUEST['file_name'] !== ('test1' || 'test2')
We start by evaluating ('test1' || 'test2')
Consider what the PHP Manual states in:
http://www.php.net/manual/en/language.types.boolean.php
You will find that 'test1' evaluates to true, and 'test2' evaluates to true.
(true || true) evaluates to true.
As such, we can simplify the expression to:
$_REQUEST['file_name'] !== true
Now, != means not equal to, while !== means not equal to or of different type:
http://www.php.net/manual/en/language.operators.comparison.php
Now, $_REQUEST['file_name'] is a string, and it is being compared to a boolean value.
As such, it is of a different type, so automatically the expression evaluates to true.
As such, you get the "bad file name" message.
Now, $REQUEST['file_name'] evaluates to true.
So for this:
$REQUEST['file_name'] != ('test1' || 'test2')
We simplify to:
$_REQUEST['file_name'] != true
And then to:
true != true
which of course is false, so "bad file name" does not get printed.
However, if $_REQUEST['file_name'] contains a false value, e.g. 0, we get
false != true, which is true, so "bad file name" gets printed.