From b453301fecc757e4d95191a65b24259e81b53f87 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Wed, 29 Jul 2015 22:52:15 +0200 Subject: [PATCH] tweeper: make is_cli() stricter Assume that tweeper is running from an actual command line only when php_sapi_name() matches _exactly_ the string "cli". This makes it possible to use tweeper in a browser using the PHP built-in web server, for which php_sapi_name() returns "cli-server". --- tweeper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tweeper.php b/tweeper.php index 5e9d242..f07382b 100644 --- a/tweeper.php +++ b/tweeper.php @@ -285,7 +285,7 @@ class Tweeper { function is_cli() { - return (substr(php_sapi_name(), 0, 3) == 'cli'); + return (php_sapi_name() === "cli"); } function usage($argv) -- 2.1.4