From: Antonio Ospite Date: Wed, 29 Jul 2015 20:56:42 +0000 (+0200) Subject: tweeper: avoid a reference to $argv in non-cli mode X-Git-Tag: v0.4~11 X-Git-Url: https://git.ao2.it/tweeper.git/commitdiff_plain/6529870c449d426d645115d3f35191c4b2023340 tweeper: avoid a reference to $argv in non-cli mode $argv is not defined in non-cli mode, so protect its usage behind an is_cli() check. For instance, this avoids a message in the PHP built-in web server, when usage() gets called: PHP Notice: Undefined variable: argv in .../tweeper.php on line 357 --- diff --git a/tweeper.php b/tweeper.php index f07382b..a9fce9b 100644 --- a/tweeper.php +++ b/tweeper.php @@ -354,7 +354,7 @@ if (is_cli()) { } if (!isset($options['src_url'])) { - fwrite($ERROR_STREAM, usage($argv)); + fwrite($ERROR_STREAM, usage(is_cli() ? $argv : NULL)); exit(1); }