Problem/Motivation
If an empty string ("") is passed in as contextual filter argument, it isn't considered a missing argument but is filtered against.
This was raised before in #2815863: Contextual filter values of "" don't trigger "When the filter value is NOT available" against D7 Views module, and originally came up in #1699378-20: Allow tokens in entity reference views selection arguments and was considered a Views (now: Core) bug in #1699378-94: Allow tokens in entity reference views selection arguments.
Steps to reproduce
Example:
$arguments = [
0 => '', // is processed in query
1 => NULL, // is skipped and default argument or default action is used
2 => 'foo' // is processed in query
];
/** @var \Drupal\views\ViewExecutable $view */
$view = Views::getView($target_id);
$view->setArguments($arguments);
$view->preExecute();
$view->execute();
An empty string as argument could be an result of a token replacement like this:
$value = '[node:field_with_no_user_input]';
$token_data = [$entity->getEntityTypeId() => $entity];
$token_service = \Drupal::token();
$arguments[] = $token_service->replace($value, $token_data);
Proposed resolution
I think sanitizing the empty string to no argument given is the expected behavior. We should however think twice making sure there really isn't a usecase for the current behavior resp. no sitebuilder's assumption might be broken.
Remaining tasks
TBD
User interface changes
TBD
API changes
TBD
Data model changes
TBD
Release notes snippet
TBD