Make WordPress Core

Opened 8 years ago

Closed 3 years ago

#36831 closed defect (bug) (wontfix)

wp_normalize_path in plugin_dir_path

Reported by: sebastianpisula's profile sebastian.pisula Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Plugins Keywords: has-patch needs-unit-tests reporter-feedback
Focuses: Cc:

Description

I suggest use wp_normalize_path in plugin_dir_path

Attachments (1)

36831.patch (588 bytes) - added by sebastian.pisula 8 years ago.

Download all attachments as: .zip

Change History (7)

#1 @ocean90
8 years ago

  • Component changed from General to Plugins
  • Keywords has-patch needs-unit-tests added

@sebastian.pisula Can you explain why this would be needed?

#2 @sebastian.pisula
8 years ago

I use Windows and XAMPP. For code

<?php
var_dump( plugin_dir_path( __FILE__ ));

I have
string(55) "D:\xampp\htdocs\wordpress\wp-content\plugins\my-plugin/"

but should be

string(55) "D:/xampp/htdocs/wordpress/wp-content/plugins/my-plugin/"

#3 @dd32
8 years ago

What's the expectation for having it using /?

I actually support adding it, although actually feel the existing result is the intended result, it's what's contained within ABSPATH and works perfectly fine on a windows system.

We don't really change/add things for the sake of adding it though, having a reason for why you expect it one way or another makes things much more valid.

#4 @swissspidy
7 years ago

  • Keywords reporter-feedback added

#6 @hellofromTonya
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Hello @sebastianpisula,

Thank you for the patch!

Though it looks odd, Windows recognizes both types of slashes and even mixed combinations of the slashes.

I'm closing this ticket as wontfix. Why?

Slashes has been discussed in multiple tickets. As it works, there hasn't yet been a compelling reason to change it.

As @ jrf comments on Ticket 48099:

This is working perfectly fine. The fact that it looks strange is irrelevant.

Thank you again for the patch!

Note: See TracTickets for help on using tickets.