diff --git a/src/wp-includes/class-wp.php b/src/wp-includes/class-wp.php
index b3bc907..1e274f5 100644
|
a
|
b
|
class WP { |
| 257 | 257 | |
| 258 | 258 | // If we're processing a 404 request, clear the error var since we found something. |
| 259 | 259 | if ( '404' == $error ) { |
| 260 | | unset( $error, $_GET['error'] ); |
| | 260 | unset( $error ); |
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | // If req_uri is empty or if it is a request for ourself, unset error. |
| 265 | 265 | if ( empty( $requested_path ) || $requested_file == $self || strpos( $_SERVER['PHP_SELF'], 'wp-admin/' ) !== false ) { |
| 266 | | unset( $error, $_GET['error'] ); |
| | 266 | unset( $error ); |
| 267 | 267 | |
| 268 | 268 | if ( isset( $perma_query_vars ) && strpos( $_SERVER['PHP_SELF'], 'wp-admin/' ) !== false ) { |
| 269 | 269 | unset( $perma_query_vars ); |
| … |
… |
class WP { |
| 366 | 366 | |
| 367 | 367 | if ( isset( $error ) ) { |
| 368 | 368 | $this->query_vars['error'] = $error; |
| | 369 | } elseif ( ! empty( $rewrite ) ) { |
| | 370 | unset( $this->query_vars['error'] ); |
| 369 | 371 | } |
| 370 | 372 | |
| 371 | 373 | /** |
diff --git a/tests/phpunit/tests/query.php b/tests/phpunit/tests/query.php
index f6a2d28..3eb7583 100644
|
a
|
b
|
class Tests_Query extends WP_UnitTestCase { |
| 696 | 696 | $this->assertSame( 'tax1', get_query_var( 'taxonomy' ) ); |
| 697 | 697 | $this->assertSame( 'term1', get_query_var( 'term' ) ); |
| 698 | 698 | } |
| | 699 | |
| | 700 | /** |
| | 701 | * @ticket 44965 |
| | 702 | */ |
| | 703 | public function _generate_get_vars_array() { |
| | 704 | $query_str = 'state=3__5e4e4d4c9df8e6948a33fdfb44f75c0f&error=access_denied&error_description=The+user+denied+your+request'; |
| | 705 | parse_str($query_str, $output); |
| | 706 | return $output; |
| | 707 | } |
| | 708 | |
| | 709 | public function _store_get_vars_in_global_variable() { |
| | 710 | global $get_vars; |
| | 711 | $get_vars = $_GET; |
| | 712 | } |
| | 713 | |
| | 714 | public function _set_get_vars_for_test_case() { |
| | 715 | $_GET = $this->_generate_get_vars_array(); |
| | 716 | return TRUE; |
| | 717 | } |
| | 718 | |
| | 719 | public function test_query_vars_strip_error_occasionally() { |
| | 720 | add_filter( 'do_parse_request', array( $this, '_set_get_vars_for_test_case' ), 11, 3 ); |
| | 721 | add_action( 'parse_request', array( $this, '_store_get_vars_in_global_variable' ), 11 ); |
| | 722 | |
| | 723 | // Trigger the hooks by going to an url |
| | 724 | $this->go_to( '' ); |
| | 725 | global $get_vars; |
| | 726 | |
| | 727 | $this->assertSame( $get_vars, $this->_generate_get_vars_array() ); |
| | 728 | } |
| 699 | 729 | } |