pods-framework / pods

The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
https://pods.io/
GNU General Public License v2.0
1.07k stars 264 forks source link

Wrong translation string format causes fatal error with PHP 8.1 #7330

Open proteo opened 2 months ago

proteo commented 2 months ago

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