Make WordPress Core

Opened 10 years ago

Closed 6 years ago

Last modified 6 years ago

#29709 closed defect (bug) (worksforme)

get_pagenum_link and double domain

Reported by: palmiak's profile palmiak Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.0
Component: Permalinks Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

get_pagenum_link generates links with double domain, for example:
http://domainname.com/http://domainname.com/page/2

The problem doesn't exist on every server and it only appers when you are using query_posts (probably new WP_query also).

A the start of get_pagenum_link() there is $request = remove_query_arg( 'paged' ); which gets data from $_SERVER. When I'm not using query posts [REQUEST_URI] => /test/page/3/, but after using it I get [REQUEST_URI] => http://domainname.com/test/page/3/.

I think there should be a check if REQUEST_URI doesn't contain domainname.

This bug was also found https://wordpress.org/support/topic/error-in-link-url-domain-name-appears-twice

Change History (6)

#1 @SergeyBiryukov
10 years ago

  • Description modified (diff)
  • Keywords reporter-feedback added

When I'm not using query posts [REQUEST_URI] => /test/page/3/, but after using it I get [REQUEST_URI] => http://domainname.com/test/page/3/.

Could you provide a piece of code to reproduce the issue?

#2 @palmiak
10 years ago

http://pastebin.com/WcYbTXms

I'm using get_pagenum_link2 to see how the $request behaves, but It's a normal get_pagenum_link with some echoes.

When you remove the 83th line than everything will work.

Version 0, edited 10 years ago by palmiak (next)

#3 @palmiak
10 years ago

  • Keywords reporter-feedback removed

#4 @jeremyfelt
9 years ago

@palmiak what web server software are you using?

Related #17047

#5 @palmiak
6 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

I'm closing this because I'm not able to repeat the bug anymore - probably was fixed somewhere in between.

#6 @ocean90
6 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.