Null coalescing operator triggers Detected usage of a non-validated input variable
#837
Milestone
Detected usage of a non-validated input variable
#837
Null coalescing operators were added to PHP in PHP7. They are "syntactic sugar for the common case of needing to use a ternary in conjunction with isset(). It returns its first operand if it exists and is not NULL; otherwise it returns its second operand."
$test = isset( $_GET['test'] ) ? $_GET['test'] : '';
can become
$test = $_GET['test'] ?? '';
At first glance, It looks like
WordPress_Sniff::is_in_isset_or_empty
needs to take Null coalescing operators into effect.The text was updated successfully, but these errors were encountered: