Make WordPress Core

Opened 16 years ago

Closed 11 years ago

Last modified 11 years ago

#7337 closed defect (bug) (fixed)

Consistently use $wp_rewrite->index instead of hardcoding "index.php"

Reported by: markjaquith's profile markjaquith Owned by: ryan's profile ryan
Milestone: 3.6 Priority: low
Severity: minor Version: 2.6
Component: Permalinks Keywords: has-patch
Focuses: Cc:

Description

A few place in our URL generation and canonicalization code use hardcoded "index.php" instead of using $wp_rewrite->index

This prevents people from using custom PATHINFO permalinks.

Attachments (2)

wp-rewrite-index.diff (4.9 KB) - added by wonderboymusic 12 years ago.
7337.diff (577 bytes) - added by andrewryno 11 years ago.

Download all attachments as: .zip

Change History (17)

#1 @matt
16 years ago

  • Milestone changed from 2.7 to 2.9

#2 @Denis-de-Bernardy
15 years ago

  • Keywords needs-patch added; permalinks pathinfo removed

#3 @Denis-de-Bernardy
15 years ago

  • Component changed from General to Permalinks
  • Owner changed from anonymous to ryan

#4 @ryan
14 years ago

  • Milestone changed from 2.9 to Future Release

#5 follow-up: @solarissmoke
13 years ago

  • Keywords close added

Is this still an issue?

#6 @mikeschinkel
13 years ago

  • Cc mikeschinkel@… added

#7 in reply to: ↑ 5 @SergeyBiryukov
13 years ago

  • Keywords close removed

Replying to solarissmoke:

Is this still an issue?

Yep, in some files:

  • wp-admin/options-permalink.php
  • wp-includes/canonical.php
  • wp-includes/link-template.php
  • wp-includes/nav-menu-template.php (maybe unrelated though)
  • wp-includes/rewrite.php
Last edited 13 years ago by SergeyBiryukov (previous) (diff)

#8 @wonderboymusic
12 years ago

  • Keywords has-patch added; needs-patch removed

Patched.

#9 @wonderboymusic
11 years ago

  • Milestone changed from Future Release to 3.6

Moving to 3.6 for review

#10 @markjaquith
11 years ago

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

In 23305:

Consistently use $wp_rewrite->index instead of hardcoding "index.php".

props wonderboymusic. fixes #7337

#11 @andrewryno
11 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

This breaks _wp_menu_item_classes_by_context() in nav-menu-template.php.

Notice: Undefined variable: wp_rewrite in wp-includes/nav-menu-template.php on line 370
Notice: Trying to get property of non-object in wp-includes/nav-menu-template.php on line 370

Need $wp_rewrite to be global for it to work.

Not sure if it breaks other places, but this is the only one I've seen.

@andrewryno
11 years ago

#12 @wonderboymusic
11 years ago

I wrote the patch a while ago, thanks for catching that :)

#13 @ryan
11 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 23309:

Declare wp_rewrite as global in _wp_menu_item_classes_by_context().

Props andrewryno
fixes #7337

#14 @Viper007Bond
11 years ago

Why not have a helper function that returns this value so that the $wp_rewrite global isn't needed? Much less prone to issues and doesn't require using global.

#15 @andrewryno
11 years ago

That would probably be better. Mine was a rather quick patch and I believe it's a global in other instances (and a global was already being defined for $wp_query) so it just made it seem more consistent.

Note: See TracTickets for help on using tickets.