[wp-trac] [WordPress Trac] #39827: notice in wp-includes/canonical.php:392

WordPress Trac noreply at wordpress.org
Fri Feb 10 02:28:04 UTC 2017


#39827: notice in wp-includes/canonical.php:392
--------------------------+-----------------------------
 Reporter:  jakubbis      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.7.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hello,

 We're getting notice in wp-includes/canonical.php:392, but it requires
 some specific steps to obtain it.

 Steps:
 1. Setup a clean install of WPML
 2. Set permalinks to postname without ending slash: /%postname%
 3. Create a page in secondary language
 4. Set this page as Home Page (under Settings/Reading) but only in the
 secondary language

 When you enter "home page", you get 404 because a page for original
 language does not exist.
 In line 121, you get {{{$redirect_url = get_permalink($redirect_post);}}}
 and value of $redirect_url is for instance "http://testsite.dev?lang=fr".
 As you see, there is no "/" before "?", that's why path is empty.

 You have already fixed  the similar issue in line:77-79

 {{{#!php
 // Notice fixing
 if ( !isset($redirect['path']) )
    $redirect['path'] = '';

 }}}

 I suspect, we need the same fix before line: 392
 {{{#!php
 $redirect['path'] = preg_replace('|/' . preg_quote( $wp_rewrite->index,
 '|' ) . '/*?$|', '/', $redirect['path']);

 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39827>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list