Index: src/wp-includes/class-wp-rewrite.php
===================================================================
--- src/wp-includes/class-wp-rewrite.php	(revision 35609)
+++ src/wp-includes/class-wp-rewrite.php	(working copy)
@@ -254,7 +254,7 @@
 	 * @access private
 	 * @var array
 	 */
-	var $endpoints;
+	var $endpoints = array();
 
 	/**
 	 * Whether to write every mod_rewrite rule for WordPress into the .htaccess file.
@@ -1669,6 +1669,7 @@
 			$query_var = $name;
 		}
 		$this->endpoints[] = array( $places, $name, $query_var );
+		$this->endpoints = array_unique( $this->endpoints, SORT_REGULAR );
 
 		if ( $query_var ) {
 			$wp->add_query_var( $query_var );
@@ -1802,7 +1803,7 @@
 	 * @access public
 	 */
 	public function init() {
-		$this->extra_rules = $this->non_wp_rules = $this->endpoints = array();
+		$this->extra_rules = $this->non_wp_rules = array();
 		$this->permalink_structure = get_option('permalink_structure');
 		$this->front = substr($this->permalink_structure, 0, strpos($this->permalink_structure, '%'));
 		$this->root = '';
Index: tests/phpunit/tests/rewrite/addRewriteEndpoint.php
===================================================================
--- tests/phpunit/tests/rewrite/addRewriteEndpoint.php	(revision 35609)
+++ tests/phpunit/tests/rewrite/addRewriteEndpoint.php	(working copy)
@@ -101,12 +101,12 @@
 		add_rewrite_endpoint( 'page_endpoint', EP_PAGES );
 		flush_rewrite_rules();
 
-		$this->go_to( get_permalink( self::$test_page_id ) . 'page_endpoint/foo/' );
+		$this->go_to( get_permalink( self::$test_page_id ) . 'page_endpoint/baz/' );
 
 		$this->assertTrue( is_page( self::$test_page_id ) );
-		$this->assertSame( 'foo', get_query_var( 'page_endpoint' ) );
+		$this->assertSame( 'baz', get_query_var( 'page_endpoint' ) );
 
-		$this->go_to( home_url( 'page_endpoint/foo/' ) );
+		$this->go_to( home_url( 'page_endpoint/baz/' ) );
 
 		$this->assertTrue( is_404() );
 		$this->assertSame( '', get_query_var( 'page_endpoint' ) );
