Potentially use whck from bin/ folder for symlinks to existing installs outside of $PATH (from PHP PoV)

This commit is contained in:
southerntofu 2022-02-20 11:58:36 -05:00
parent 4cffbb64b3
commit eb67748679
2 changed files with 6 additions and 2 deletions

2
bin/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

View File

@ -97,9 +97,11 @@ function verify_claim(string $payload, string $claim, string $id, string $valida
function find_whck() {
// BUG: https://bugs.php.net/bug.php?id=77782
// $_ENV['whck'] and getenv("whck") are empty, but getenv()["whck"] works!
// NOTE: We use is_file not file_exists() because there may be a whck/ folder
// In that case, we check for bin/whck
return isset(getenv()['WHCK']) ? getenv()['WHCK'] // from $ENV
: (file_exists('whck') ? './whck' // from current directory
: 'whck');
: (is_file('whck') ? './whck' // from current directory
: (is_file('bin/whck') ? 'bin/whck' : 'whck'));
}
//enum Validator {