pods icon indicating copy to clipboard operation
pods copied to clipboard

Wrong translation string format causes fatal error with PHP 8.1

Open proteo opened this issue 1 year ago • 0 comments

Description

After upgrading a client's website to PHP 8.1 this error appears in the screen when accessing a Portuguese (pt-pt) translated page:

Fatal error: Uncaught ValueError: Missing format specifier at end of string in /var/www/html/wp-content/plugins/pods/classes/PodsInit.php on line 2006
ValueError: Missing format specifier at end of string in /var/www/html/wp-content/plugins/pods/classes/PodsInit.php on line 2006

After the call stack list, PHP displays the last function call which reveals the the cause of the error: the translation string is missing the "s" after the % symbol:

[sprintf](http://www.php.net/function.sprintf)( $format = 'Todos os %', $values = 'Pod Templates' )

Version

3.2.4

Testing Instructions

No response

Screenshots / Screencast

Screenshot 2024-07-20 at 11 22 25 a m

Possible Workaround

The error can be fixed by downloading the /wp-content/languages/plugins/pods-pt_PT.po and associated .mo files and manually edit it (in my case using POEdit) to change the line 918 from:

msgstr "Todos os %"

to:

msgstr "Todos os %s"

Then uploading the file again.

Site Health Information

No response

Pods Package

No response

proteo avatar Jul 20 '24 17:07 proteo