Problem/Motivation
I came across an intriguing bug in Drupal 10 views when configuring pager options. If the offset field is left empty, it triggers a PHP type error. In Drupal 10, the expected value for the offset field is 0, but when it is empty, it becomes offset: null instead.
TypeError: Cannot assign null to property Drupal\views\Plugin\views\query\QueryPluginBase::$offset of type int in Drupal\views\Plugin\views\query\QueryPluginBase->setOffset() (line 152 of core/modules/views/src/Plugin/views/query/QueryPluginBase.php).
Steps to reproduce
1. Enable views and views_ui module with D10.
2. Pick a views then set the `pager` - items to display (leave it as default), offset (default is 0, remove it so that the field is empty)
3. Save it (Click 'Apply'))
4. The PHP TypeError can be found in PHP logs.
Proposed resolution
Strictly type the $offset parameter in setOffset to int
Update all places that call setOffset to cast the offset to an integer
MR 4707 is the canonical source for this issue.
Remaining tasks
Agree on approachTests
Action #17
User interface changes
None
API changes
setOffset requires an integer