Opened 5 years ago
Last modified 3 weeks ago
#39827 reopened defect (bug)
notice in wp-includes/canonical.php:392
Reported by: | jakubbis | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 4.7.2 |
Component: | Canonical | Keywords: | has-patch needs-testing needs-unit-tests |
Focuses: | Cc: |
Description
Hello,
We're getting notice in wp-includes/canonical.php:392, but it requires some specific steps to obtain it.
Steps:
- Setup a clean install of WPML
- Set permalinks to postname without ending slash: /%postname%
- Create a page in secondary language
- 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
// Notice fixing
if ( !isset($redirect['path']) )
$redirect['path'] = '';
I suspect, we need the same fix before line: 392
$redirect['path'] = preg_replace('|/' . preg_quote( $wp_rewrite->index, '|' ) . '/*?$|', '/', $redirect['path']);
Attachments (1)
Change History (21)
#4
@
5 years ago
Hi @jakubbis,
Thank you for submitting this report and the detailed information with it.
I have taken a look at the file and the locations you mentioned and I have determined where this problem is coming from.
There are two error suppressed calls to parse_url
which both can cause this issue.
This ticket was mentioned in Slack in #core by obenland. View the logs.
5 years ago
#10
@
9 months ago
- Milestone changed from Future Release to 5.8
- Owner set to SergeyBiryukov
- Status changed from new to reviewing
This ticket was mentioned in Slack in #core-test by hellofromtonya. View the logs.
7 months ago
This ticket was mentioned in Slack in #core-test by hellofromtonya. View the logs.
6 months ago
This ticket was mentioned in Slack in #core-test by francina. View the logs.
6 months ago
#14
@
6 months ago
- Keywords needs-unit-tests added
- Milestone changed from 5.8 to 5.9
Today is 5.8 Beta 1. As there's been no activity, punting to 5.9.
This ticket was mentioned in Slack in #core-test by hellofromtonya. View the logs.
6 months ago
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
6 weeks ago
#17
@
6 weeks ago
- Resolution set to invalid
- Status changed from reviewing to closed
There is no need to assign an empty string after empty checking. Going to close this ticket. from bug scrub discussion.
#18
@
6 weeks ago
- Resolution invalid deleted
- Status changed from closed to reopened
It looks like there was some confusion during the bug scrub, as someone thought the problem is already solved in lines 83-85 of canonical.php.
However, that part was introduced in [9506] and adjusted in [13866]. It already existed when this ticket was created. The patch here touches a different area of the code, after the parse_url()
call in line 568 further down.
The ticket still seems valid. Reopening for additional review.
Related: #34353