Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken after-search redirect after 3.7.3 on servers with missing $_REQUEST['_wp_http_referer'] #1075

Open
seredniy opened this issue Jul 1, 2024 · 2 comments
Labels
priority: normal The issue/PR is normal priority—not many people are affected or there’s a workaround, etc. type: bug The issue is a confirmed bug.

Comments

@seredniy
Copy link

seredniy commented Jul 1, 2024

Hey there!

After the 3.7.3 release on some servers without $_REQUEST['_wp_http_referer'] this redirect is broken:

if ( ! empty( $_REQUEST['_wp_http_referer'] && ! empty( $_SERVER['REQUEST_URI'] ) ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
	// _wp_http_referer is used only on bulk actions, we remove it to keep the $_GET shorter
	wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
	exit;
}

For example, WPForms users now have this issue:

shot_glZN0

After searching I got this URL:

https://site.com/wp-admin/admin.php?page=wpforms-tools&s=asdas&_wpnonce=986a40ee25&_wp_http_referer=%2Fwp-admin%2Fadmin.php%3Fpage%3Dwpforms-tools%26view%3Daction-scheduler%26s%3Dwpforms&action=-1&paged=1&action2=-1

And the view changed to the default tab.

It's reproducible for some servers without the $_REQUEST['_wp_http_referer'] parameter. For example Local by Flywheel. No $_REQUEST['_wp_http_referer'] parameter exists, but HTTP_REFERER is set.

@coreymckrill coreymckrill added type: bug The issue is a confirmed bug. priority: normal The issue/PR is normal priority—not many people are affected or there’s a workaround, etc. labels Jul 10, 2024
@barryhughes
Copy link
Member

Thanks for the report, @seredniy!

  • Can you confirm if $_GET['_wp_http_referer'] is still set in these cases?
  • If you are able to determine this (either by calls to ini_get() or just by inspecting the output of phpinfo()), can you tell me the values of PHP's request_order and variables_order settings?

Just confirming we're addressing the correct thing.

@dimitris-am
Copy link

Hey @barryhughes!
I can also reproduce this locally with Local by Flywheel.

  • $_GET['_wp_http_referer'] is indeed set and it's pointing to the page before this redirection happens
    • /wp-admin/admin.php?page=wpforms-tools&view=action-scheduler&s=wpforms
  • request_order is GP and variables_order is GPCS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: normal The issue/PR is normal priority—not many people are affected or there’s a workaround, etc. type: bug The issue is a confirmed bug.
Projects
None yet
Development

No branches or pull requests

4 participants