Ticket #21682: 21682.3.diff
File 21682.3.diff, 1.9 KB (added by , 8 years ago) |
---|
-
src/wp-includes/class-wp-rewrite.php
254 254 * @access private 255 255 * @var array 256 256 */ 257 var $endpoints ;257 var $endpoints = array(); 258 258 259 259 /** 260 260 * Whether to write every mod_rewrite rule for WordPress into the .htaccess file. … … 1669 1669 $query_var = $name; 1670 1670 } 1671 1671 $this->endpoints[] = array( $places, $name, $query_var ); 1672 $this->endpoints = array_unique( $this->endpoints, SORT_REGULAR ); 1672 1673 1673 1674 if ( $query_var ) { 1674 1675 $wp->add_query_var( $query_var ); … … 1802 1803 * @access public 1803 1804 */ 1804 1805 public function init() { 1805 $this->extra_rules = $this->non_wp_rules = $this->endpoints =array();1806 $this->extra_rules = $this->non_wp_rules = array(); 1806 1807 $this->permalink_structure = get_option('permalink_structure'); 1807 1808 $this->front = substr($this->permalink_structure, 0, strpos($this->permalink_structure, '%')); 1808 1809 $this->root = ''; -
tests/phpunit/tests/rewrite/addRewriteEndpoint.php
101 101 add_rewrite_endpoint( 'page_endpoint', EP_PAGES ); 102 102 flush_rewrite_rules(); 103 103 104 $this->go_to( get_permalink( self::$test_page_id ) . 'page_endpoint/ foo/' );104 $this->go_to( get_permalink( self::$test_page_id ) . 'page_endpoint/baz/' ); 105 105 106 106 $this->assertTrue( is_page( self::$test_page_id ) ); 107 $this->assertSame( ' foo', get_query_var( 'page_endpoint' ) );107 $this->assertSame( 'baz', get_query_var( 'page_endpoint' ) ); 108 108 109 $this->go_to( home_url( 'page_endpoint/ foo/' ) );109 $this->go_to( home_url( 'page_endpoint/baz/' ) ); 110 110 111 111 $this->assertTrue( is_404() ); 112 112 $this->assertSame( '', get_query_var( 'page_endpoint' ) );