Opened 11 years ago
Closed 11 years ago
#31224 closed defect (bug) (fixed)
maybe_add_existing_user_to_blog() returns http response 500 even on success
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.2 | Priority: | normal |
| Severity: | normal | Version: | 4.1 |
| Component: | Users | Keywords: | has-patch |
| Focuses: | multisite | Cc: |
Description (last modified by )
File: wp-includes/ms-functions.php
Function: maybe_add_existing_user_to_blog()
Line: 1938
Calling this function will return HTTP 500 (Server Error) even when the function succeeds. This can cause problems when a caching server such as Varnish reacts unfavorably to the 500 and redirects the user to a sorry page.
Replace line 1938 with the following to correct.
wp_die( sprintf( __( 'You have been added to this site. Please visit the <a href="%s">homepage</a> or <a href="%s">log in</a> using your username and password.' ), home_url(), admin_url() ), __( 'WordPress › Success' ), array( 'response' => 200 ) );
Attachments (2)
Change History (8)
#1
@
11 years ago
- Description modified (diff)
- Keywords needs-patch added
- Milestone changed from Awaiting Review to 4.2
#5
@
11 years ago
- Focuses multisite added
Thanks for the report @drzaphod!
I think we can stick to only adding a 200 response to the success message in 31224.diff. Keeping the default as 500 for the actual error matches many other cases in core right now.
Note: See
TracTickets for help on using
tickets.
Thanks, @MikeHansenMe. Should we maybe add the same response code to the other
wp_die()call as well? It also appears to be a legit user-facing error message.