From eb677486798095851c83fba4b4a19c7c917f92bb Mon Sep 17 00:00:00 2001 From: southerntofu Date: Sun, 20 Feb 2022 11:58:36 -0500 Subject: [PATCH] Potentially use whck from bin/ folder for symlinks to existing installs outside of $PATH (from PHP PoV) --- bin/.gitignore | 2 ++ index.php | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 bin/.gitignore diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/index.php b/index.php index 197ef7d..b9d16f2 100644 --- a/index.php +++ b/index.php @@ -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 {