WordPress.org

Make WordPress Core

Opened 17 months ago

Closed 3 months ago

Last modified 3 months ago

#22630 closed defect (bug) (wontfix)

plugin_basename() fails on case-sensitive plugin directories

Reported by: bungeshea Owned by:
Milestone: Priority: normal
Severity: trivial Version: 1.5
Component: Plugins Keywords:
Focuses: Cc:

Description

When WP_PLUGIN_DIR has slightly different casing to the actual path, plugin_basename() returns the full path to the plugin file.

For example:

If WP_PLUGIN_DIR is set to C:/Website/wp-content/plugins, but the actual file-system path is C:/Website/wp-content/Plugins, plugin_basename() will return the full path to the plugin file.

The plugin_basename() function uses a preg_replace statement to find path to the plugin relative from WP_PLUGIN_DIR. If the actual path to the plugin directory does not match case to WP_PLUGIN_DIR, the preg_replace will fail. This is because preg_replace is not case sensitive.

Change History (5)

comment:1 in reply to: ↑ description rmccue17 months ago

Replying to bungeshea:

The plugin_basename() function uses a preg_replace statement to find path to the plugin relative from WP_PLUGIN_DIR. If the actual path to the plugin directory does not match case to WP_PLUGIN_DIR, the preg_replace will fail. This is because preg_replace is not case sensitive.

I think you mean it is case sensitive. This makes sense, since on every platform except Windows, paths are case sensitive.

Maybe this could be changed to be insensitive on Windows, but for most platforms, this is the correct behaviour.

Last edited 17 months ago by rmccue (previous) (diff)

comment:2 nacin17 months ago

  • Severity changed from normal to minor
  • Version changed from trunk to 1.5

comment:3 nacin3 months ago

  • Component changed from General to Plugins
  • Keywords 2nd-opinion added

comment:4 bungeshea3 months ago

  • Resolution set to wontfix
  • Severity changed from minor to trivial
  • Status changed from new to closed

This is a very minor issue. As long as you set your plugin directory correctly, you should be fine.

comment:5 ocean903 months ago

  • Keywords 2nd-opinion removed
  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.