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
A recent forum support topic raised a critical TypeError in our Email Reporting pointer. While pointers should be stored in the database as a string, if for any reason the value is changed to an array in the database (in the support case this was due to possible SQL injection) then the the value will be returned as an array.
WP Core guards against this by casting to (string) wherever dismissed_wp_pointers are queried from user meta:
if ( in_array( self::SLUG, $dismissed_wp_pointers, true ) ) {
returnfalse;
}
}
Both can have this guard added to avoid the stated issue.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance Criteria
Loading the WordPress dashboard (index.php) no longer fatals with a TypeError when dismissed_wp_pointers user meta is not a string.
The Email Reporting admin pointer and the view-only dashboard admin pointer both continue to hide themselves when the user has dismissed the matching pointer via core's dismiss-wp-pointer flow.
Implementation Brief
Backend
Update file includes/Core/Email_Reporting/Email_Reporting_Pointer.php use of the pointer meta to cast to string.
Update file includes/Core/Dashboard_Sharing/View_Only_Pointer.php use of the pointer meta to cast to string.
Add a case where dismissed_wp_pointers meta is stored as an array (via update_user_meta( $user_id, 'dismissed_wp_pointers', array( 'foo' ) )) and assert is_active( 'index.php' ) does not throw and returns the expected boolean.
Bug Description
A recent forum support topic raised a critical TypeError in our Email Reporting pointer. While pointers should be stored in the database as a string, if for any reason the value is changed to an array in the database (in the support case this was due to possible SQL injection) then the the value will be returned as an array.
WP Core guards against this by casting to
(string)whereverdismissed_wp_pointersare queried from user meta:https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/class-wp-internal-pointers.php#L80
https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/plugin-editor.php#L351
We have two examples of unguarded user meta queries to
dismissed_wp_pointers:site-kit-wp/includes/Core/Email_Reporting/Email_Reporting_Pointer.php
Lines 138 to 146 in 8d0b099
site-kit-wp/includes/Core/Dashboard_Sharing/View_Only_Pointer.php
Lines 97 to 104 in 8d0b099
Both can have this guard added to avoid the stated issue.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance Criteria
index.php) no longer fatals with aTypeErrorwhendismissed_wp_pointersuser meta is not a string.dismiss-wp-pointerflow.Implementation Brief
Backend
Update file
includes/Core/Email_Reporting/Email_Reporting_Pointer.phpuse of the pointer meta to cast to string.Update file
includes/Core/Dashboard_Sharing/View_Only_Pointer.phpuse of the pointer meta to cast to string.Test Coverage
Update file
tests/phpunit/integration/Core/Email_Reporting/Email_Reporting_PointerTest.phpdismissed_wp_pointersmeta is stored as an array (viaupdate_user_meta( $user_id, 'dismissed_wp_pointers', array( 'foo' ) )) and assertis_active( 'index.php' )does not throw and returns the expected boolean.Update file
tests/phpunit/integration/Core/Dashboard_Sharing/View_Only_PointerTest.phpactive_callback.QA Brief
View-only user pointer
dismissed_wp_pointersitem in the_usermetatable for your user ID, and change it to an array, such asa:1:{i:0;s:3:"foo";}.Email Reporting pointer
dismissed_wp_pointersitem in the_usermetatable for your user ID, and change it to an array, such asa:1:{i:0;s:3:"foo";}.Changelog entry
dismissed_wp_pointersuser meta contains an unexpected type.