Changeset 59595
- Timestamp:
- 01/09/2025 07:41:47 PM (5 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/user.php
r59377 r59595 49 49 ); 50 50 51 if ( ! empty( $_POST['log'] ) ) {51 if ( ! empty( $_POST['log'] ) && is_string( $_POST['log'] ) ) { 52 52 $credentials['user_login'] = wp_unslash( $_POST['log'] ); 53 53 } 54 if ( ! empty( $_POST['pwd'] ) ) {54 if ( ! empty( $_POST['pwd'] ) && is_string( $_POST['pwd'] ) ) { 55 55 $credentials['user_password'] = $_POST['pwd']; 56 56 } -
trunk/tests/phpunit/tests/auth.php
r58653 r59595 636 636 637 637 /** 638 * Tests that a warning or a fatal error is not thrown when the login or password 639 * passed via `$_POST` is an array instead of a string. 640 * 641 * The messages that we should not see: 642 * `Warning: wp_strip_all_tags() expects parameter #1 ($text) to be a string, array given`. 643 * `TypeError: trim(): Argument #1 ($string) must be of type string, array given`. 644 * 645 * @ticket 62794 646 */ 647 public function test_wp_signon_does_not_throw_fatal_errors_with_array_parameters() { 648 $_POST['log'] = array( 'example' ); 649 $_POST['pwd'] = array( 'example' ); 650 651 $error = wp_signon(); 652 $this->assertWPError( $error, 'The result should be an instance of WP_Error.' ); 653 654 $error_codes = $error->get_error_codes(); 655 $this->assertContains( 'empty_username', $error_codes, 'The "empty_username" error code should be present.' ); 656 $this->assertContains( 'empty_password', $error_codes, 'The "empty_password" error code should be present.' ); 657 } 658 659 /** 638 660 * HTTP Auth headers are used to determine the current user. 639 661 *
Note: See TracChangeset
for help on using the changeset viewer.