WordPress.org

Make WordPress Core

Opened 5 months ago

Last modified 5 months ago

#41180 new defect (bug)

ABSPATH definition - incorrect on chrooted vhost

Reported by: dacartpl Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8
Component: Bootstrap/Load Keywords: has-patch
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 5 months ago.

Download all attachments as: .zip

Change History (4)

#1 @dacartpl
5 months ago

  • Keywords needs-patch added

#2 @DrewAPicture
5 months 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
5 months ago

#3 @Presskopp
5 months ago

  • Keywords has-patch added; needs-patch removed

Patch as @dacartpl proposed

Note: See TracTickets for help on using tickets.