|
87 | 87 | extern char *ap_php_optarg;
|
88 | 88 | extern int ap_php_optind;
|
89 | 89 |
|
90 |
| -#define OPTSTRING "aB:Cc:d:E:eF:f:g:hilmnqR:r:sw?vz:" |
| 90 | +#define OPTSTRING "aB:Cc:d:E:eF:f:g:hilmnqRH:r:sw?vz" |
91 | 91 |
|
92 | 92 | static int print_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
|
93 | 93 | {
|
@@ -317,6 +317,7 @@ static void php_cli_usage(char *argv0)
|
317 | 317 | " -R <code> Run PHP <code> for every input line\n"
|
318 | 318 | " -F <file> Parse and execute <file> for every input line\n"
|
319 | 319 | " -E <end_code> Run PHP <end_code> after processing all input lines\n"
|
| 320 | + " -H Hide any passed arguments\n" |
320 | 321 | " -s Display colour syntax highlighted source.\n"
|
321 | 322 | " -v Version number\n"
|
322 | 323 | " -w Display source with stripped comments and whitespace.\n"
|
@@ -471,6 +472,7 @@ int main(int argc, char *argv[])
|
471 | 472 | char *exec_direct=NULL, *exec_run=NULL, *exec_begin=NULL, *exec_end=NULL;
|
472 | 473 | const char *param_error=NULL;
|
473 | 474 | int scan_input = 0;
|
| 475 | + int hide_argv = 0; |
474 | 476 | /* end of temporary locals */
|
475 | 477 | #ifdef ZTS
|
476 | 478 | zend_compiler_globals *compiler_globals;
|
@@ -780,6 +782,9 @@ int main(int argc, char *argv[])
|
780 | 782 | case 'z': /* load extension file */
|
781 | 783 | zend_load_extension(ap_php_optarg);
|
782 | 784 | break;
|
| 785 | + case 'H': |
| 786 | + hide_argv = 1; |
| 787 | + break; |
783 | 788 |
|
784 | 789 | default:
|
785 | 790 | break;
|
@@ -844,6 +849,14 @@ int main(int argc, char *argv[])
|
844 | 849 | }
|
845 | 850 | CG(start_lineno) = lineno;
|
846 | 851 | *arg_excp = arg_free; /* reconstuct argv */
|
| 852 | + |
| 853 | + if (hide_argv) { |
| 854 | + int i; |
| 855 | + for (i = 1; i < argc; i++) { |
| 856 | + memset(argv[i], 0, strlen(argv[i])); |
| 857 | + } |
| 858 | + } |
| 859 | + |
847 | 860 | if (no_headers) {
|
848 | 861 | SG(headers_sent) = 1;
|
849 | 862 | SG(request_info).no_headers = 1;
|
|
0 commit comments