From fd08f062ae5a3c92bfc0345da7e83ab320046864 Mon Sep 17 00:00:00 2001 From: Ivan Mikheykin Date: Fri, 17 Jan 2020 22:26:35 +0300 Subject: Fix bug #78323: Code 0 is returned on invalid options Set CLI exit code to 1 when invalid parameters are passed, and print error to stderr. --- main/php_getopt.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'main/php_getopt.h') diff --git a/main/php_getopt.h b/main/php_getopt.h index a8b2f89b4c..027e152952 100644 --- a/main/php_getopt.h +++ b/main/php_getopt.h @@ -35,6 +35,9 @@ extern PHPAPI int php_optidx; PHPAPI int php_getopt(int argc, char* const *argv, const opt_struct opts[], char **optarg, int *optind, int show_err, int arg_start); END_EXTERN_C() +/* php_getopt will return this value if there is an error in arguments */ +#define PHP_GETOPT_INVALID_ARG (-2) + #endif /* -- cgit v1.2.1