]> granicus.if.org Git - php/commitdiff
- Made CLI option -d output error and exit if an non-existing (or unmodifyable) entry...
authorfoobar <sniper@php.net>
Thu, 17 Mar 2005 13:43:32 +0000 (13:43 +0000)
committerfoobar <sniper@php.net>
Thu, 17 Mar 2005 13:43:32 +0000 (13:43 +0000)
sapi/cli/php_cli.c

index aab039a8f660dfe4c8ee4b7011d165a42c7c90c9..6fe8982f350fa55f3611e70f7e06b78e171ae7dc 100644 (file)
@@ -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 */