Skip to content

ABSPATH bootstrap issue with 2.0.3 #303

Description

@mikemanger

We have a plugin file with some constants loaded in as a bootstrap file:

parameters:
	bootstrapFiles:
		- wp-content/plugins/my-plugin/my-plugin.php
	paths:
		- wp-content/plugins/my-plugin
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

define( 'PLUGIN_DIR_PATH', plugin_dir_path( __FILE__ ) );

/**
 * Used for TCPDF.
 */
require_once ABSPATH . 'vendor/autoload.php';

// ...

This worked fine in version 2.0.2 however in 2.0.3 it gives the error:

Note: Using configuration file /agent/build/phpstan.neon.dist.
Warning: require_once(/vendor/autoload.php): Failed to open stream: No such file or directory in /agent/build/wp-content/plugins/my-plugin/my-plugin.php on line 23
Error thrown in /agent/build/wp-content/plugins/my-plugin/my-plugin.php on line 23 while loading bootstrap file /agent/build/wp-content/plugins/my-plugin/my-plugin.php: Failed opening required '/vendor/autoload.php' (include_path='.:/usr/local/lib/php')
Script phpstan analyse --memory-limit=2048M handling the phpstan event returned with error code 1

It seems to be due to ABSPATH getting changed from ./ to / (1d6d3f3).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions