[wp-trac] [WordPress Trac] #60299: Default assignment of `use_ssl` user meta value causes unnecessary DB write.
WordPress Trac
noreply at wordpress.org
Sun Apr 21 23:44:31 UTC 2024
#60299: Default assignment of `use_ssl` user meta value causes unnecessary DB
write.
-------------------------------------------------+-------------------------
Reporter: prettyboymp | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.6
Component: Users | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests needs- | Focuses:
testing has-testing-info | performance
-------------------------------------------------+-------------------------
Changes (by rajinsharwar):
* keywords: has-patch has-unit-tests => has-patch has-unit-tests needs-
testing has-testing-info
Comment:
Added the unit tests for this.
''Instructions to test if someone is willing to help:''
1. Edit any user from the Admin Dashboard, and copy that user's ID.
2. Add the below lines just after the statement of {{{ function
update_metadata( $meta_type, $object_id, ..) }}}
{{{
if ( $meta_key == 'use_ssl' ){
error_log( 'Use SSL value in Meta: ' . ' ' .
print_r(gettype($meta_value), true));
}
}}}
3. Now, in your theme's functions.php, add the below line of code. Replace
the **USER_ID** with the int value you copied in step 1.
{{{
error_log( 'Use SSL value in DB: ' . ' ' . gettype(get_user_meta( USER_ID,
'use_ssl', true )) );
}}}
4. Without making any changes to the Profile of that user, simply click
"Update User"
5. In your Error Log file, you should see that both the datatypes in the
error log outputs will be different. ❌
6. Now, apply the patch, and re-do the steps. You will find the Data types
are the same. ✅
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60299#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list