diff --git a/src/future/exec/PhutilExecutableFuture.php b/src/future/exec/PhutilExecutableFuture.php --- a/src/future/exec/PhutilExecutableFuture.php +++ b/src/future/exec/PhutilExecutableFuture.php @@ -143,7 +143,7 @@ foreach ($known_keys as $known_key) { $value = getenv($known_key); - if (strlen($value)) { + if ($value && $value !== '') { $default_env[$known_key] = $value; } } diff --git a/src/future/http/HTTPFuture.php b/src/future/http/HTTPFuture.php --- a/src/future/http/HTTPFuture.php +++ b/src/future/http/HTTPFuture.php @@ -149,7 +149,8 @@ $this->stateWriteComplete = true; } - while (($data = fread($this->socket, 32768)) || strlen($data)) { + while (($data = fread($this->socket, 32768)) || + ($data && $data !== '')) { $this->response .= $data; } diff --git a/src/toolset/workflow/ArcanistShellCompleteWorkflow.php b/src/toolset/workflow/ArcanistShellCompleteWorkflow.php --- a/src/toolset/workflow/ArcanistShellCompleteWorkflow.php +++ b/src/toolset/workflow/ArcanistShellCompleteWorkflow.php @@ -194,7 +194,7 @@ $file = $spec['file']; $home = getenv('HOME'); - if (!strlen($home)) { + if (!$home || !phutil_nonempty_string($home)) { throw new PhutilArgumentUsageException( pht( 'The "HOME" environment variable is not defined, so this workflow '. @@ -343,7 +343,7 @@ pht('Detecting current shell...')); $shell_env = getenv('SHELL'); - if (!strlen($shell_env)) { + if (!$shell_env || !phutil_nonempty_string($shell_env)) { $log->writeWarning( pht('SHELL'), pht( diff --git a/src/workflow/ArcanistPatchWorkflow.php b/src/workflow/ArcanistPatchWorkflow.php --- a/src/workflow/ArcanistPatchWorkflow.php +++ b/src/workflow/ArcanistPatchWorkflow.php @@ -366,7 +366,7 @@ case self::SOURCE_PATCH: if ($param == '-') { $patch = @file_get_contents('php://stdin'); - if (!strlen($patch)) { + if (!$patch || !phutil_nonempty_string($patch)) { throw new ArcanistUsageException( pht('Failed to read patch from stdin!')); }