Today I learned…

Last weekend, I decided to update this website: the WordPress version, the plugins and the PHP version on the server itself. That last update had an interesting consequence: the OpenID plugin broke (which I didn’t notice until I got a nightly warning email).

The (kindly) supplied error message and stacktrace pointed quite straightforward to the cause of the problem: ”¬†Uncaught ValueError: Unknown format specifier ” ” … #0 /home/xxx/domains/ printf()”.

I decided to take the hard route and try to fix the problem by hand. On the indicated line I found a printf statement with a %1 placeholder in it. As always, Stackoverflow gave the solution almost immediately: in PHP 8, a placeholder must always be terminated with a $, and optionally a format specifier like “s” (for string). So I replaced all the %1’s with %1$1 and, simple as that, OpenID worked again, allowing me to log in again (which can be quite handy).

When looking at the plugin code, I noticed the use of a function “named” __. Some googling showed that this is a built-in WordPress function for translating the given string using the current locale. It is somewhat similar to PHP’s own gettext() function, which can be aliased using a single _. And I thought Python was strange for using dunders (double underscores) in function names!