Opened 7 years ago
Closed 7 years ago
#44403 closed defect (bug) (duplicate)
WP_Error object is not returned. Only assigned to a variable
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.1 |
Component: | Users | Keywords: | has-patch |
Focuses: | Cc: |
Description
Function: wp_validate_user_request_key
File: wp-includes/user.php
Line no.: 3512
According to the doc comment the above function should return wither a boolean value or a WP_Error object.
* @return bool|WP_Error WP_Error on failure, true on success.
At line number 3512 the WP_Error object is stored in a variable but never returned.
<?php ... if ( ! $wp_hasher->CheckPassword( $key, $saved_key ) ) { return new WP_Error( 'invalid_key', __( 'Invalid key' ) ); } if ( ! $expiration_time || time() > $expiration_time ) { $return = new WP_Error( 'expired_key', __( 'The confirmation email has expired.' ) ); // Line no. 3512. The new error object was never returned. } return true;
Shouldn't it be
<?php if ( ! $expiration_time || time() > $expiration_time ) { return new WP_Error( 'expired_key', __( 'The confirmation email has expired.' ) ); }
like the code block just above it?
I am uploading a proposed patch for this. Please let me know if this works.
Attachments (1)
Change History (5)
Note: See
TracTickets for help on using
tickets.
This has already been reported and fixed. Please refer to the following ticket.
https://core.trac.wordpress.org/ticket/44298