Make WordPress Core

Opened 22 months ago

Last modified 22 months ago

#56495 assigned defect (bug)

For multi site, The emial content used with sprint and filter wpmu_signup_user_notification_email

Reported by: kp4net's profile kp4net Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.0.2
Component: General Keywords: has-patch reporter-feedback
Focuses: multisite Cc:

Description

In the file "wp-includes/ms-functions.php" line no 1082.

It's used sprintf function and also used filters in it as well so if someone applies this filter and updates the content of the subject with any specifiers from the below screenshot it will throw an error as sprintf function has only a string to replace but if the someone update content with more specifiers will not work.
So we should separate out sprintf and filter that is used in it.

Thanks

Attachments (2)

diff.patch (5.3 KB) - added by kp4net 22 months ago.
Changes patch attached here
specifiers.png (128.9 KB) - added by kp4net 22 months ago.
Sprintf other specifiers

Download all attachments as: .zip

Change History (7)

@kp4net
22 months ago

Changes patch attached here

@kp4net
22 months ago

Sprintf other specifiers

This ticket was mentioned in Slack in #core by kp4net. View the logs.


22 months ago

#2 @kp4net
22 months ago

Here is the pull request for this bug.
https://github.com/WordPress/wordpress-develop/pull/3174

Last edited 22 months ago by kp4net (previous) (diff)

This ticket was mentioned in PR #3174 on WordPress/wordpress-develop by kp4net.


22 months ago
#3

  • Keywords has-patch added; needs-patch removed

#4 follow-up: @jrf
22 months ago

  • Keywords reporter-feedback added

It's used sprintf function and also used filters in it as well so if someone applies this filter and updates the content of the subject with any specifiers from the below screenshot it will throw an error as sprintf function has only a string to replace but if the someone update content with more specifiers will not work.

Hi @kp4net, welcome to Trac!

I'm trying to understand your issue. If I understand it correctly, a plugin or themes which is filtering the phrases used here is returning a phrase with additional placeholders, which subsequently leads to errors.

Looking at your PR, moving the filters out of the sprintf() would not be a solution for that. That would just moved the problem to a different point in the code flow as it doesn't solve the underlying problem of a plugin/theme not doing the filtering correctly.

#5 in reply to: ↑ 4 @kp4net
22 months ago

Replying to jrf:

It's used sprintf function and also used filters in it as well so if someone applies this filter and updates the content of the subject with any specifiers from the below screenshot it will throw an error as sprintf function has only a string to replace but if the someone update content with more specifiers will not work.

Hi @kp4net, welcome to Trac!

I'm trying to understand your issue. If I understand it correctly, a plugin or themes which is filtering the phrases used here is returning a phrase with additional placeholders, which subsequently leads to errors.

Looking at your PR, moving the filters out of the sprintf() would not be a solution for that. That would just moved the problem to a different point in the code flow as it doesn't solve the underlying problem of a plugin/theme not doing the filtering correctly.

Hey @jrf

Thanks for the quick reply and check.

Yes, You understood the issue correctly that a plugin or theme which is filtering the phrases used here is returning an expression with additional placeholders, which subsequently leads to errors.

As I have checked and tested it with one of my client's sites we are using this filter to convert the message content to HTML, and it works fine for me. I can not understand your point that the code flow doesn't solve the underlying problem as we are already applying this filter next after to the sprintf function called and also we pass the necessary parameters/arguments in this filter. only the difference is that earlier we are passing message content expression with placeholders now in this PR we pass message content with replace the placeholders with values of it and of course, we are passing the values as well to these filters.

Thanks.

Note: See TracTickets for help on using tickets.