(#23273) ignore empty YAML files

YAML.load returns false or nil for an empty file and for a file with
only the YAML header respectively. This commit uses {} as a safe default
value and returns it when nil or false is encountered.
(maint) Add test coverage for unexpected YAML values
Merge branch 'issue/stable/23273-backport-emtpy-yaml-fix-to-stable' into stable

* issue/stable/23273-backport-emtpy-yaml-fix-to-stable:
  (maint) Add test coverage for unexpected YAML values
  (#23273) ignore empty YAML files