Opened 22 months ago
Closed 22 months ago
#8821 closed defect (bug) (fixed)
Preventing ArgumentCountError when using sprintf/printf functions
Reported by: | imath | Owned by: | slaFFik |
---|---|---|---|
Milestone: | 11.1.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | I18N | Keywords: | dev-feedback has-patch |
Cc: |
Description
Some Polyglots locale team might not have updated their translated string or have used wrong placeholder causing fatals into the plugin:
See https://buddypress.org/support/topic/uncaught-argumentcounterror-bp-blogs-activity-php233/
See https://buddypress.org/support/topic/php-fatal-error-uncaught-valueerror/
I believe a function to check for these placeholders would be nice to have.
Change History (4)
This ticket was mentioned in Slack in #buddypress by imath. View the logs.
22 months ago
This ticket was mentioned in PR #66 on buddypress/buddypress by @imath.
22 months ago
#2
- Keywords has-patch added
In 11.0 we have removed 1 placeholder to 2 strings used to display the activity action for published posts. Issues were raised about the fact some polyglots team did not update corresponding translations leaving the removed placeholder. As these two strings are used inside
sprintf()
function it resulted fatal errors for the corresponding locales. We hope improving the comment will avoid such mistakes. It is a temporary fix, the right one would be to create a sanitization function wrappingsprintf()
to make sure expected placeholders are found into the translated string. Although this kind of function should be made available by WordPress imho, a quick check into some tickets reported upstream made us realize this would not happen. We will handle it for our usage.Trac ticket: https://buddypress.trac.wordpress.org/ticket/8821