WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 15 months ago

#36831 new defect (bug)

wp_normalize_path in plugin_dir_path

Reported by: sebastian.pisula Owned by:
Milestone: Awaiting Review 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 2 years ago.

Download all attachments as: .zip

Change History (5)

#1 @ocean90
2 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
2 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
2 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
15 months ago

  • Keywords reporter-feedback added
Note: See TracTickets for help on using tickets.