Skip to content

Commit

Permalink
Reapply original fix, tests pass (slight update)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsilverstein committed Sep 30, 2024
1 parent ca979c9 commit 17047a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/wp-includes/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -2366,8 +2366,8 @@ function wp_insert_user( $userdata ) {
$admin_color = empty( $userdata['admin_color'] ) ? 'fresh' : $userdata['admin_color'];
$meta['admin_color'] = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $admin_color );

$meta['use_ssl'] = empty( $userdata['use_ssl'] ) ? 0 : (bool) $userdata['use_ssl'];

$meta['use_ssl'] = empty( $userdata['use_ssl'] ) || ! $userdata['use_ssl'] ? '0' : '1';

Check failure on line 2370 in src/wp-includes/user.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Whitespace found at end of line
$meta['show_admin_bar_front'] = empty( $userdata['show_admin_bar_front'] ) ? 'true' : $userdata['show_admin_bar_front'];

$meta['locale'] = isset( $userdata['locale'] ) ? $userdata['locale'] : '';
Expand Down
11 changes: 5 additions & 6 deletions tests/phpunit/tests/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -2268,19 +2268,18 @@ public function test_unnecessary_assignment_of_use_ssl_in_meta() {
$_POST = array(
'nickname' => 'nickname_test',
'email' => 'email_test_1@example.com',
'use_ssl' => 0,
'use_ssl' => 1,
);

$user_id = edit_user( $user_id );

$this->assertIsInt( $user_id );
$this->assertEquals( 1, $set_db_counts );
$_POST['email'] = 'email_test_2@example.com';

$user_id = edit_user( $user_id );
// No update to the use_ssl meta.
$this->assertEquals( 1, $set_db_counts );
$_POST['email'] = 'email_test_2@example.com';
$user_id = edit_user( $user_id );

// Verify there are no updates to the use_ssl meta.
$this->assertEquals( 1, $set_db_counts );
}

/**
Expand Down

0 comments on commit 17047a9

Please sign in to comment.