Make WordPress Core

Opened 11 years ago

Closed 6 years ago

#36831 closed defect (bug) (wontfix)

wp_normalize_path in plugin_dir_path

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

Description

I suggest use wp_normalize_path in plugin_dir_path

Attachments (1)

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

Download all attachments as: .zip

Change History (7)

#1 @ocean90
11 years ago

  • Component General → Plugins
  • Keywords has-patch needs-unit-tests added

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

#2 @sebastian.pisula
11 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
11 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
10 years ago

  • Keywords reporter-feedback added

#6 @hellofromTonya
6 years ago

  • Milestone Awaiting Review
  • Resolution → wontfix
  • Status new → 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.