You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* translators: %s: an activity title (e.g. "Update") */
__( 'Unmarked activity "%s" as spam', 'stream' ),
wp_strip_all_tags( $activity->action )
),
array(
'id' => $activity->id,
'item_id' => $activity->item_id,
'type' => $activity->type,
'author' => $activity->user_id,
),
In the above case, vsprintf( 'Unmarked activity "something 5% Do something"', [ 'id' => ?, 'item_id' => ??, ... ] ) is called, which is obviously wrong.
It appears that a number of connectors are calling log() and passing context to the vsprintf args key, instead of args that should be interpolated into the message.
This is a little more prevalent in the plugin than I expected, but appears to mostly not be an issue as it's rare for the $message to contain a % character.
The text was updated successfully, but these errors were encountered:
Personally speaking, I'd drop printf support in the Log::log( $message ) arg and require all connectors/uses perform the sprintf at that point in time, converting the $args into a "Message context" parameter instead. That however prevents the filters from being able to filter the saved message by altering the passed data 🤷
Bug Report
Similar to #1508, the BuddyPress connector (And it appears others, by reading code) are still affected by that..
Expected Behavior
The $message passed to
Log::log()
should be a printf-ready string, instead it's often containing prepared data.Actual Behavior
stream/connectors/class-connector-buddypress.php
Lines 678 to 689 in 393ab0c
In the above case,
vsprintf( 'Unmarked activity "something 5% Do something"', [ 'id' => ?, 'item_id' => ??, ... ] )
is called, which is obviously wrong.It appears that a number of connectors are calling
log()
and passing context to the vsprintf args key, instead of args that should be interpolated into the message.Here's an example of a correct usage:
stream/connectors/class-connector-users.php
Lines 155 to 169 in 393ab0c
Here's another example of an incorrect usage (That happens to pass, as the first key of the $args happens to be the one wanted)
stream/connectors/class-connector-comments.php
Lines 238 to 245 in 393ab0c
This is a little more prevalent in the plugin than I expected, but appears to mostly not be an issue as it's rare for the
$message
to contain a%
character.The text was updated successfully, but these errors were encountered: