You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please add the exact versions used for each of the following:
WP Emerge: 0.17.0
WordPress: 6.1.1
PHP: 8.0.15
Expected behavior
When returning a response of type App::redirect()->to( ... ) as controller action result the redirect should happen immediately and stop any further rendering and processing after the redirect headers are returned.
Actual behavior
The processing continues and the page that is called upon gets fully rendered although unnecessary. All actions and filters fire.
Steps to reproduce (in case of a bug)
Create a controller action that returns App::redirect()->to( ... )
Make it fire on an existing admin page like users.php
Check if all of users.php actions a filters fire.
Comments
I know it is a somewhat edge case, but here my setup - I am extending the admin users.php functions with additional actions. I added custom route conditions to catch these. Example : /wp-admin/users.php?dplt-action=mark_as_deleted is caught by my controller and processed properly. The problem is that I redirect back to users.php?role=whatever is set. At the redirect I don't want to have all of the users.php processing firing after my controller is done anyway. Unfortunately, since there is no exit or die it does. This mainly messes up my approach to flashing messages as admin notices, but also slows down the page without any need. So, I would like to suggest the following fix, if it won't cause other issues : add in ResponseService change sendHeaders like this :
Version
Please add the exact versions used for each of the following:
Expected behavior
When returning a response of type
App::redirect()->to( ... )
as controller action result the redirect should happen immediately and stop any further rendering and processing after the redirect headers are returned.Actual behavior
The processing continues and the page that is called upon gets fully rendered although unnecessary. All actions and filters fire.
Steps to reproduce (in case of a bug)
App::redirect()->to( ... )
Comments
I know it is a somewhat edge case, but here my setup - I am extending the admin users.php functions with additional actions. I added custom route conditions to catch these. Example :
/wp-admin/users.php?dplt-action=mark_as_deleted
is caught by my controller and processed properly. The problem is that I redirect back tousers.php?role=whatever is set
. At the redirect I don't want to have all of the users.php processing firing after my controller is done anyway. Unfortunately, since there is noexit
ordie
it does. This mainly messes up my approach to flashing messages as admin notices, but also slows down the page without any need. So, I would like to suggest the following fix, if it won't cause other issues : add in ResponseService change sendHeaders like this :I tried it and it works, but again - I don't know if it is fully safe and won't cause other issues for WPEmerge inernally.
The text was updated successfully, but these errors were encountered: