fixed error in filter email when headers are not set or not an array
This commit is contained in:
@@ -125,8 +125,16 @@ function find_user_id_from_headers(&$args) {
|
|||||||
if (!isset($args['headers'])) {
|
if (!isset($args['headers'])) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$user_id = null;
|
|
||||||
$headers = $args['headers'];
|
$headers = $args['headers'];
|
||||||
|
if (empty($headers)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (!is_array($headers)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_id = null;
|
||||||
|
|
||||||
// isset returns false if the key exists but its value is null : 'user_id'=>null : https://stackoverflow.com/questions/3803282/check-if-value-isset-and-null
|
// isset returns false if the key exists but its value is null : 'user_id'=>null : https://stackoverflow.com/questions/3803282/check-if-value-isset-and-null
|
||||||
if (array_key_exists('user_id', $headers)) {
|
if (array_key_exists('user_id', $headers)) {
|
||||||
$user_id = $headers['user_id'];
|
$user_id = $headers['user_id'];
|
||||||
|
|||||||
Reference in New Issue
Block a user