Make WordPress Core

Opened 7 years ago

Last modified 5 years ago

#41180 new defect (bug)

ABSPATH definition - incorrect on chrooted vhost

Reported by: dacartpl's profile dacartpl Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8
Component: Bootstrap/Load Keywords: has-patch needs-testing
Focuses: performance Cc:

Description

ABSPATH defined in wp-load.php (and in other files) returns incorrect string on chrooted vhosts (double slash '/' instead of a single):

<?php
if ( ! defined( 'ABSPATH' ) ) {
        define( 'ABSPATH', dirname( __FILE__ ) . '/' );
}

On chrooted vhost - output of dirname( FILE ) is '/' and no need to add additional '/' at the end of string.

It would be nice if the ABSPATH definition looked like the following:

<?php

if ( ! defined( 'ABSPATH' ) ) {
        define( 'ABSPATH', ('/' === dirname( __FILE__ )) ? dirname( __FILE__ ) : dirname( __FILE__ ) . '/' );
}

Attachments (1)

41180.diff (583 bytes) - added by Presskopp 7 years ago.

Download all attachments as: .zip

Change History (5)

#1 @dacartpl
7 years ago

  • Keywords needs-patch added

#2 @DrewAPicture
7 years ago

  • Focuses performance added

Hi @dacartpl, welcome to Core Trac! If you're willing, I'd encourage you to upload a patch yourself, either diffed against https://develop.svn.wordpress.org or http://develop.git.wordpress.org, your preference.

For more on contributing patches, see submitting a patch in our core handbook.

@Presskopp
7 years ago

#3 @Presskopp
7 years ago

  • Keywords has-patch added; needs-patch removed

Patch as @dacartpl proposed

#4 @Presskopp
5 years ago

  • Keywords needs-testing added
Note: See TracTickets for help on using tickets.