Ticket #10935: 10935.5.diff
| File 10935.5.diff, 3.5 KB (added by , 12 years ago) |
|---|
-
tests/phpunit/tests/query/conditionals.php
629 629 // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1', 630 630 // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]', 631 631 // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]', 632 633 function test_bad_dates() { 634 $this->go_to( '/2013/13/13/' ); 635 $this->assertQueryTrue( 'is_404' ); 636 637 $this->go_to( '/2013/11/41/' ); 638 $this->assertQueryTrue( 'is_404' ); 639 } 632 640 } -
tests/phpunit/tests/canonical.php
239 239 240 240 array( '/?year=2008', '/2008/'), 241 241 242 array( '/2012/13/', '/2012/'), 243 array( '/2012/11/51/', '/2012/11/'), 244 242 245 // Authors 243 246 array( '/?author=%d', '/author/canonical-author/' ), 244 247 // array( '/?author=%d&year=2008', '/2008/?author=3'), -
src/wp-includes/query.php
1513 1513 1514 1514 if ( $qv['day'] ) { 1515 1515 if ( ! $this->is_date ) { 1516 $this->is_day = true; 1517 $this->is_date = true; 1516 $date = sprintf( '%04d-%02d-%02d', $qv['year'], $qv['monthnum'], $qv['day'] ); 1517 if ( $qv['monthnum'] && $qv['year'] && ! wp_checkdate( $qv['monthnum'], $qv['day'], $qv['year'], $date ) ) { 1518 $qv['error'] = '404'; 1519 } else { 1520 $this->is_day = true; 1521 $this->is_date = true; 1522 } 1518 1523 } 1519 1524 } 1520 1525 1521 1526 if ( $qv['monthnum'] ) { 1522 1527 if ( ! $this->is_date ) { 1523 $this->is_month = true; 1524 $this->is_date = true; 1528 if ( 12 < $qv['monthnum'] ) { 1529 $qv['error'] = '404'; 1530 } else { 1531 $this->is_month = true; 1532 $this->is_date = true; 1533 } 1525 1534 } 1526 1535 } 1527 1536 -
src/wp-includes/canonical.php
101 101 } 102 102 } 103 103 104 if ( get_query_var( 'day' ) && get_query_var( 'monthnum' ) && get_query_var( 'year' ) ) { 105 $year = get_query_var( 'year' ); 106 $month = get_query_var( 'monthnum' ); 107 $day = get_query_var( 'day' ); 108 $date = sprintf( '%04d-%02d-%02d', $year, $month, $day ); 109 if ( ! wp_checkdate( $month, $day, $year, $date ) ) { 110 $redirect_url = get_month_link( $year, $month ); 111 $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum', 'day' ), $redirect_url ); 112 } 113 } elseif ( get_query_var( 'monthnum' ) && get_query_var( 'year' ) && 12 < get_query_var( 'monthnum' ) ) { 114 $redirect_url = get_year_link( get_query_var( 'year' ) ); 115 $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum' ), $redirect_url ); 116 } 117 104 118 if ( ! $redirect_url ) { 105 119 if ( $redirect_url = redirect_guess_404_permalink() ) { 106 120 $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'page', 'feed', 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url );