Skip to content

Commit

Permalink
Ensure WP_CLI_ROOT is defined before accessing it (wp-cli#5697)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbachhuber authored Nov 1, 2022
1 parent 4143651 commit df48093
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion php/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
const FILE_DIR_PATTERN = '%(?>#.*?$)|(?>//.*?$)|(?>/\*.*?\*/)|(?>\'(?:(?=(\\\\?))\1.)*?\')|(?>"(?:(?=(\\\\?))\2.)*?")|(?<file>\b__FILE__\b)|(?<dir>\b__DIR__\b)%ms';

function inside_phar() {
return 0 === strpos( WP_CLI_ROOT, PHAR_STREAM_PREFIX );
return defined( 'WP_CLI_ROOT' ) && 0 === strpos( WP_CLI_ROOT, PHAR_STREAM_PREFIX );
}

// Files that need to be read by external programs have to be extracted from the Phar archive.
Expand Down

0 comments on commit df48093

Please sign in to comment.