Make WordPress Core

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#5160 closed defect (bug) (fixed)

REQUEST_URI fix for IIS misses certain configurations

Reported by: brh's profile brh Owned by: ryan's profile ryan
Milestone: 2.6 Priority: normal
Severity: normal Version: 2.5
Component: General Keywords: REQUEST_URI has-patch needs-testing
Focuses: Cc:

Description

The host I use (on IIS6) stores what would normally be in "PATH_INFO" in "ORIG_PATH_INFO". This confuses Wordpress' fixes in wp-settings.php, leading to a REQUEST_URI that is missing the page name. For example:

If I'm on: http://brh.numbera.com/blog/wp-admin/edit.php?paged=2

It would produce: http://brh.numbera.com/blog/wp-admin/?paged=2

Attachments (3)

wp-settings.php.diff (898 bytes) - added by brh 17 years ago.
Patch against trunk (rev. 6201) to resolve this issue.
wp-setting3.diff (1.2 KB) - added by snakefoot 17 years ago.
Patch for trunk (Updated with check if PATH_INFO is empty)
wp-setting_23.diff (1.2 KB) - added by snakefoot 17 years ago.
Patch for branch 2.3 (Updated with check if PATH_INFO is empty)

Download all attachments as: .zip

Change History (28)

@brh
17 years ago

Patch against trunk (rev. 6201) to resolve this issue.

#1 @brh
17 years ago

  • Keywords has_patch needs_testing added

#2 @foolswisdom
17 years ago

  • Keywords has-patch needs-testing added; has_patch needs_testing removed
  • Milestone set to 2.4

#3 @markjaquith
17 years ago

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

(In [6203]) Check for ORIG_PATH_INFO on IIS. props brh, fixes #5160

#4 @snakefoot
17 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Think the proper solution is to remove the "If root then simulate that no script-name was specified". It only works for the index.php and fails when running around in the admin-panel.

-Rolf

#5 @snakefoot
17 years ago

  • Milestone changed from 2.4 to 2.3.1

#6 @markjaquith
17 years ago

  • Milestone changed from 2.3.1 to 2.4

Snakefoot, but that reverts the ORIG_PATH_INFO change.

Perhaps we should check ORIG_PATH_INFO earlier and set PATH_INFO from it. That way we can just use PATH_INFO from then on.

#7 @snakefoot
17 years ago

The problem is that REQUEST_URI is missing the page name, while rest of the path is correct (Everything comes from SCRIPT_NAME). The patches I have attached fixes the problem with the missing page-name, by not removing it from SCRIPT_NAME (bug introduced by me).

The bug introduced by me breaks the admin-panel, and should be fixed on trunk and branch right away.

If we should handle the situation of ORIG_PATH_INFO being set and no PATH_INFO, then we need to know the values of PATH_INFO, ORIG_PATH_INFO, SCRIPT_NAME in these two situations:

http://brh.numbera.com/blog/index.php
http://brh.numbera.com/blog/index.php/my-post-name/

#8 @brh
17 years ago

At http://brh.numbera.com/blog/index.php

PATH_INFO:
ORIG_PATH_INFO: /blog/index.php
SCRIPT_NAME: /blog/index.php

At http://brh.numbera.com/blog/index.php/2007/09/09/new-version-of-the-popupnotify-windows-forms-control/

PATH_INFO: /2007/09/09/new-version-of-the-popupnotify-windows-forms-control/
ORIG_PATH_INFO: /blog/index.php/2007/09/09/new-version-of-the-popupnotify-windows-forms-control/
SCRIPT_NAME: /blog/index.php

#9 @brh
17 years ago

Dang, there should be some newlines there, but you get the picture.

#10 @snakefoot
17 years ago

The combination of just SCRIPT_NAME + PATH_INFO seems to cover your configuration, without needing the ORIG_PATH_INFO as PATH_INFO is being set.

Not sure if all PHP + CGI configurations configures the ORIG_PATH_INFO as being the combination of SCRIPT_NAME + PATH_INFO. But if they did, then the patch to handle the situation of no PATH_INFO would look something like this:

    if (isset(ORIG_PATH_INFO) && empty(PATH_INFO) && SCRIPT_NAME!=ORIG_PATH_INFO)
        REQUEST_URI = ORIG_PATH_INFO;
    else
    if (SCRIPT_NAME==PATH_INFO)
        REQUEST_URI = SCRIPT_NAME;
    else
        REQUEST_URI = SCRIPT_NAME . PATH_INFO;

    REQUEST_URI .= QUERY_INFO

Not sure it is a good idea to try fix a bug which cannot be tested if fixed. The two patches I have attached for trunk and branch will solve the problem for brh.

#11 @markjaquith
17 years ago

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

(In [6208]) IIS REQUEST_URI-setting fixes from snakefoot. fixes #5160 for trunk

#12 follow-up: @markjaquith
17 years ago

  • Milestone changed from 2.4 to 2.3.1
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for 2.3.1 consideration. brh, can you let me know if that changeset fixes the issue for you? Feedback from people with other IIS configurations would also be appreciated.

#13 in reply to: ↑ 12 @brh
17 years ago

Snakefoot's patch works for me.

#14 @tellyworth
17 years ago

[6208] removed an empty() check in the older code, allowing an Undefined Index notice if $_SERVERPATH_INFO? is not set. Not sure if that warrants a new ticket.

#15 @markjaquith
17 years ago

tellyworth,

Have you seen this Undefined Index notice or is this just hypothetical?

#16 @westi
17 years ago

  • Milestone changed from 2.3.1 to 2.3.2

2.3.1 has been released moving to 2.3.2

@snakefoot
17 years ago

Patch for trunk (Updated with check if PATH_INFO is empty)

@snakefoot
17 years ago

Patch for branch 2.3 (Updated with check if PATH_INFO is empty)

#17 @Cimmo
17 years ago

  • Cc cimmino.marco@… added

A person emailed me that have a bug with my plug-in (Cimy Swift SMTP) and IIS, so I gave him the patched wp-settings.php and all went ok.

The code not working under IIS was:

<form method="post" action="<?php echo $_SERVER['REQUEST_URI'];?>&amp;updated=true">

but also this piece of code that I gave to him to fix the problem wasn't ok before and it's ok after the patched wp-settings.php:

<form method="post" action="<?php echo add_query_arg('updated', 'true', wp_get_original_referer()); ?>">

so my 2 cents for this fix :)

#18 @lloydbudd
17 years ago

  • Milestone changed from 2.3.2 to 2.3.3

#19 @Otto42
17 years ago

  • Milestone changed from 2.3.4 to 2.5.1
  • Version set to 2.5

People with 2.5 are reporting the undefined index errors on IIS from this patch:

See: http://wordpress.org/support/topic/164618

#20 @ryan
17 years ago

  • Owner changed from anonymous to ryan
  • Status changed from reopened to new

#21 @ryan
17 years ago

(In [7757]) Check if PATH_INFO is set to avoid undefined index errors. see #5160

#22 @ryan
17 years ago

(In [7758]) Check if PATH_INFO is set to avoid undefined index errors. see #5160

#23 @ryan
17 years ago

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

#24 @ryan
17 years ago

  • Milestone changed from 2.5.2 to 2.9

Milestone 2.5.2 deleted

#25 @westi
17 years ago

  • Milestone changed from 2.9 to 2.6
Note: See TracTickets for help on using tickets.