Ticket #5160 (closed defect: fixed)

Opened 1 year ago

Last modified 3 months ago

REQUEST_URI fix for IIS misses certain configurations

Reported by: brh Assigned to: ryan
Priority: normal Milestone: 2.6
Component: General Version: 2.5
Severity: normal Keywords: REQUEST_URI has-patch needs-testing
Cc: cimmino.marco@gmail.com

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

wp-settings.php.diff (0.9 kB) - added by brh on 10/08/07 07:55:01.
Patch against trunk (rev. 6201) to resolve this issue.
wp-setting3.diff (1.2 kB) - added by snakefoot on 11/16/07 07:46:50.
Patch for trunk (Updated with check if PATH_INFO is empty)
wp-setting_23.diff (1.2 kB) - added by snakefoot on 11/16/07 07:47:48.
Patch for branch 2.3 (Updated with check if PATH_INFO is empty)

Change History

10/08/07 07:55:01 changed by brh

  • attachment wp-settings.php.diff added.

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

10/08/07 07:57:11 changed by brh

  • keywords changed from REQUEST_URI to REQUEST_URI has_patch needs_testing.

10/08/07 18:45:18 changed by foolswisdom

  • keywords changed from REQUEST_URI has_patch needs_testing to REQUEST_URI has-patch needs-testing.
  • milestone set to 2.4.

10/08/07 20:48:29 changed by markjaquith

  • status changed from new to closed.
  • resolution set to fixed.

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

10/08/07 22:53:17 changed by snakefoot

  • status changed from closed to reopened.
  • resolution deleted.

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

10/08/07 22:55:31 changed by snakefoot

  • milestone changed from 2.4 to 2.3.1.

10/09/07 05:01:22 changed by markjaquith

  • 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.

10/09/07 07:36:49 changed by snakefoot

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/

10/09/07 16:16:55 changed by brh

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

10/09/07 16:17:33 changed by brh

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

10/09/07 17:33:03 changed by snakefoot

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.

10/09/07 17:38:26 changed by markjaquith

  • status changed from reopened to closed.
  • resolution set to fixed.

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

(follow-up: ↓ 13 ) 10/09/07 17:39:25 changed by markjaquith

  • status changed from closed to reopened.
  • resolution deleted.
  • milestone changed from 2.4 to 2.3.1.

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.

(in reply to: ↑ 12 ) 10/10/07 03:57:01 changed by brh

Snakefoot's patch works for me.

10/12/07 05:27:03 changed by tellyworth

[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.

10/17/07 21:17:02 changed by markjaquith

tellyworth,

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

10/28/07 11:04:48 changed by westi

  • milestone changed from 2.3.1 to 2.3.2.

2.3.1 has been released moving to 2.3.2

11/16/07 07:46:50 changed by snakefoot

  • attachment wp-setting3.diff added.

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

11/16/07 07:47:48 changed by snakefoot

  • attachment wp-setting_23.diff added.

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

12/18/07 14:48:45 changed by Cimmo

  • cc set to cimmino.marco@gmail.com.

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 :)

01/04/08 23:38:42 changed by lloydbudd

  • milestone changed from 2.3.2 to 2.3.3.

04/11/08 19:17:58 changed by Otto42

  • version set to 2.5.
  • milestone changed from 2.3.4 to 2.5.1.

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

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

04/14/08 19:38:31 changed by ryan

  • owner changed from anonymous to ryan.
  • status changed from reopened to new.

04/21/08 17:35:26 changed by ryan

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

04/21/08 17:36:04 changed by ryan

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

06/16/08 20:23:48 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

07/15/08 16:24:07 changed by ryan

  • milestone changed from 2.5.2 to 2.9.

Milestone 2.5.2 deleted

07/30/08 20:27:57 changed by westi

  • milestone changed from 2.9 to 2.6.