Changeset 60240
- Timestamp:
- 05/17/2025 01:29:20 PM (8 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-includes/user.php (modified) (1 diff)
-
tests/phpunit/tests/user/retrievePassword.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/user.php
r60178 r60240 3173 3173 3174 3174 // Use the passed $user_login if available, otherwise use $_POST['user_login']. 3175 if ( ! $user_login && ! empty( $_POST['user_login'] ) ) {3175 if ( ! $user_login && ! empty( $_POST['user_login'] ) && is_string( $_POST['user_login'] ) ) { 3176 3176 $user_login = $_POST['user_login']; 3177 3177 } -
trunk/tests/phpunit/tests/user/retrievePassword.php
r59312 r60240 88 88 $this->assertWPError( retrieve_password() ); 89 89 } 90 91 /** 92 * Tests that a fatal error is not thrown when the login passed via `$_POST` 93 * is an array instead of a string. 94 * 95 * The message that we should not see: 96 * `TypeError: trim(): Argument #1 ($string) must be of type string, array given`. 97 * 98 * @ticket 62794 99 */ 100 public function test_retrieve_password_does_not_throw_fatal_error_with_array_parameters() { 101 $_POST['user_login'] = array( 'example' ); 102 103 $error = retrieve_password(); 104 $this->assertWPError( $error, 'The result should be an instance of WP_Error.' ); 105 106 $error_codes = $error->get_error_codes(); 107 $this->assertContains( 'empty_username', $error_codes, 'The "empty_username" error code should be present.' ); 108 } 90 109 }
Note: See TracChangeset
for help on using the changeset viewer.