civi/core/Locale->uf doesn't get set usually
This started as what I thought was a simple php 8.1 warning: CRM_Core_I18n::singleton()->setLocale('en_US')
gives one of those "don't pass null as a string parameter" warnings. But then I looked into a bit.
- Unit tests don't catch this because the error is happening when setting the UF locale, and in the unit test UF it doesn't do anything.
- The only way the parameter is not null is if the
uf
member of \Civi\Core\Locale gets set. But that only happens when code is doing things in a way that nobody (currently) does things. It doesn't happen by callingCRM_Core_I18n::singleton()->setLocale()
. - In drupal 7 in a stock install, these get swallowed and don't even appear on screen. You can see them if you comment out this line, and then do e.g.
cv ev "CRM_Core_I18n::singleton()->setLocale('en_US');"
. - Looks like it's from https://github.com/civicrm/civicrm-core/commit/1190626dc6669a5a9242ab788a64d058e42dd9cb.
- I'm a little scared to touch setLocale().