So while the error printed on stderr is misleading, the result printed on stdout is correct, and so is the return code.
I am still going to SRU the updated patch to jammy, as I think it's useful, but it shouldn't impact firefox's checking whether it is the default browser.
I am testing in a fully up-to-date Kubuntu 22.04 VM:
$ xdg-settings check default-web-browser firefox_ firefox. desktop bin/xdg- settings: 734: [: x!: unexpected operator
/usr/
yes
$ echo $?
0
So while the error printed on stderr is misleading, the result printed on stdout is correct, and so is the return code.
I am still going to SRU the updated patch to jammy, as I think it's useful, but it shouldn't impact firefox's checking whether it is the default browser.