Skip to content

Defining constant with __FILE__ in name breaks execution #5332

@aaemnnosttv

Description

@aaemnnosttv

Bug Report

Describe the current, buggy behavior

Defining a constant in wp-config.php that includes __FILE__ in the name of the constant, causes wp-cli to fail with this error message:

Parse error: syntax error, unexpected 'var' (T_VAR) in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()'d code on line 66

Using latest v2.4.0 phar executable.

Describe how other contributors can replicate this bug

  1. Add this line to wp-config.php
    define( 'WP_CONFIG__FILE__', __FILE__ );
  2. Run wp
  3. See the above error, command fails

Describe what you expect as the correct outcome

I would expect the wp command list to display.

Let us know what environment you are running this on

OS:	Linux 4.9.184-linuxkit #1 SMP Tue Jul 2 22:58:16 UTC 2019 x86_64
Shell:	
PHP binary:	/usr/local/bin/php
PHP version:	7.3.9
php.ini used:	/usr/local/etc/php/php.ini
WP-CLI root dir:	phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:	phar://wp-cli.phar/vendor
WP_CLI phar path:	/var/www/html
WP-CLI packages dir:	
WP-CLI global config:	
WP-CLI project config:	
WP-CLI version:	2.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions