From 9c2c04b580c9f5605263392eefdafd45563e2c57 Mon Sep 17 00:00:00 2001 From: foobar Date: Thu, 17 Mar 2005 13:43:32 +0000 Subject: - Made CLI option -d output error and exit if an non-existing (or unmodifyable) entry is passed --- sapi/cli/php_cli.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'sapi/cli') diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index aab039a8f6..6fe8982f35 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -395,7 +395,7 @@ static void php_cli_usage(char *argv0) } /* }}} */ -static void define_command_line_ini_entry(char *arg TSRMLS_DC) +static int define_command_line_ini_entry(char *arg TSRMLS_DC) { char *name, *value; @@ -413,8 +413,9 @@ static void define_command_line_ini_entry(char *arg TSRMLS_DC) ZVAL_STRING(&extension, value, 0); php_dl(&extension, MODULE_PERSISTENT, &zval TSRMLS_CC); } else { - zend_alter_ini_entry(name, strlen(name)+1, value, strlen(value), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); + return zend_alter_ini_entry(name, strlen(name)+1, value, strlen(value), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); } + return SUCCESS; } @@ -661,7 +662,10 @@ int main(int argc, char *argv[]) switch (c) { case 'd': /* define ini entries on command line */ - define_command_line_ini_entry(php_optarg TSRMLS_CC); + if (define_command_line_ini_entry(php_optarg TSRMLS_CC) == FAILURE) { + zend_printf("Invalid php.ini entry '%s'.\n", php_optarg); + goto err; + } break; case 'h': /* help & quit */ -- cgit v1.2.1