@@ -596,11 +596,11 @@ static int do_cli(int argc, char **argv) /* {{{ */
596
596
volatile int request_started = 0 ;
597
597
char * php_optarg = NULL , * orig_optarg = NULL ;
598
598
int php_optind = 1 , orig_optind = 1 ;
599
- char * exec_direct = NULL , * exec_run = NULL , * exec_begin = NULL , * exec_end = NULL ;
600
- char * arg_free = NULL , * * arg_excp = & arg_free ;
601
- char * script_file = NULL , * translated_path = NULL ;
599
+ char * exec_direct = NULL , * exec_run = NULL , * exec_begin = NULL , * exec_end = NULL ;
600
+ char * arg_free = NULL , * * arg_excp = & arg_free ;
601
+ char * script_file = NULL , * translated_path = NULL ;
602
602
bool interactive = false;
603
- const char * param_error = NULL ;
603
+ const char * param_error = NULL ;
604
604
bool hide_argv = false;
605
605
int num_repeats = 1 ;
606
606
pid_t pid = getpid ();
@@ -615,7 +615,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
615
615
switch (c ) {
616
616
617
617
case 'i' : /* php info & quit */
618
- if (php_request_startup ()== FAILURE ) {
618
+ if (php_request_startup () == FAILURE ) {
619
619
goto err ;
620
620
}
621
621
request_started = 1 ;
@@ -651,7 +651,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
651
651
goto out ;
652
652
653
653
case 'm' : /* list compiled in modules */
654
- if (php_request_startup ()== FAILURE ) {
654
+ if (php_request_startup () == FAILURE ) {
655
655
goto err ;
656
656
}
657
657
request_started = 1 ;
@@ -706,7 +706,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
706
706
param_error = param_mode_conflict ;
707
707
break ;
708
708
}
709
- context .mode = PHP_CLI_MODE_PROCESS_STDIN ;
709
+ context .mode = PHP_CLI_MODE_PROCESS_STDIN ;
710
710
script_file = php_optarg ;
711
711
break ;
712
712
@@ -725,7 +725,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
725
725
if (context .mode != PHP_CLI_MODE_STANDARD ) {
726
726
break ;
727
727
}
728
- context .mode = PHP_CLI_MODE_LINT ;
728
+ context .mode = PHP_CLI_MODE_LINT ;
729
729
/* We want to set the error exit status if at least one lint failed.
730
730
* If all were successful we set the exit status to 0.
731
731
* We already set EG(exit_status) here such that only failures set the exit status. */
@@ -746,8 +746,8 @@ static int do_cli(int argc, char **argv) /* {{{ */
746
746
param_error = param_mode_conflict ;
747
747
break ;
748
748
}
749
- context .mode = PHP_CLI_MODE_CLI_DIRECT ;
750
- exec_direct = php_optarg ;
749
+ context .mode = PHP_CLI_MODE_CLI_DIRECT ;
750
+ exec_direct = php_optarg ;
751
751
break ;
752
752
753
753
case 'R' :
@@ -760,8 +760,8 @@ static int do_cli(int argc, char **argv) /* {{{ */
760
760
param_error = param_mode_conflict ;
761
761
break ;
762
762
}
763
- context .mode = PHP_CLI_MODE_PROCESS_STDIN ;
764
- exec_run = php_optarg ;
763
+ context .mode = PHP_CLI_MODE_PROCESS_STDIN ;
764
+ exec_run = php_optarg ;
765
765
break ;
766
766
767
767
case 'B' :
@@ -774,8 +774,8 @@ static int do_cli(int argc, char **argv) /* {{{ */
774
774
param_error = param_mode_conflict ;
775
775
break ;
776
776
}
777
- context .mode = PHP_CLI_MODE_PROCESS_STDIN ;
778
- exec_begin = php_optarg ;
777
+ context .mode = PHP_CLI_MODE_PROCESS_STDIN ;
778
+ exec_begin = php_optarg ;
779
779
break ;
780
780
781
781
case 'E' :
@@ -788,24 +788,24 @@ static int do_cli(int argc, char **argv) /* {{{ */
788
788
param_error = param_mode_conflict ;
789
789
break ;
790
790
}
791
- context .mode = PHP_CLI_MODE_PROCESS_STDIN ;
792
- exec_end = php_optarg ;
791
+ context .mode = PHP_CLI_MODE_PROCESS_STDIN ;
792
+ exec_end = php_optarg ;
793
793
break ;
794
794
795
795
case 's' : /* generate highlighted HTML from source */
796
796
if (context .mode == PHP_CLI_MODE_CLI_DIRECT || context .mode == PHP_CLI_MODE_PROCESS_STDIN ) {
797
797
param_error = "Source highlighting only works for files.\n" ;
798
798
break ;
799
799
}
800
- context .mode = PHP_CLI_MODE_HIGHLIGHT ;
800
+ context .mode = PHP_CLI_MODE_HIGHLIGHT ;
801
801
break ;
802
802
803
803
case 'w' :
804
804
if (context .mode == PHP_CLI_MODE_CLI_DIRECT || context .mode == PHP_CLI_MODE_PROCESS_STDIN ) {
805
805
param_error = "Source stripping only works for files.\n" ;
806
806
break ;
807
807
}
808
- context .mode = PHP_CLI_MODE_STRIP ;
808
+ context .mode = PHP_CLI_MODE_STRIP ;
809
809
break ;
810
810
811
811
case 'z' : /* load extension file */
@@ -815,23 +815,23 @@ static int do_cli(int argc, char **argv) /* {{{ */
815
815
hide_argv = true;
816
816
break ;
817
817
case 10 :
818
- context .mode = PHP_CLI_MODE_REFLECTION_FUNCTION ;
818
+ context .mode = PHP_CLI_MODE_REFLECTION_FUNCTION ;
819
819
reflection_what = php_optarg ;
820
820
break ;
821
821
case 11 :
822
- context .mode = PHP_CLI_MODE_REFLECTION_CLASS ;
822
+ context .mode = PHP_CLI_MODE_REFLECTION_CLASS ;
823
823
reflection_what = php_optarg ;
824
824
break ;
825
825
case 12 :
826
- context .mode = PHP_CLI_MODE_REFLECTION_EXTENSION ;
826
+ context .mode = PHP_CLI_MODE_REFLECTION_EXTENSION ;
827
827
reflection_what = php_optarg ;
828
828
break ;
829
829
case 13 :
830
- context .mode = PHP_CLI_MODE_REFLECTION_ZEND_EXTENSION ;
830
+ context .mode = PHP_CLI_MODE_REFLECTION_ZEND_EXTENSION ;
831
831
reflection_what = php_optarg ;
832
832
break ;
833
833
case 14 :
834
- context .mode = PHP_CLI_MODE_REFLECTION_EXT_INFO ;
834
+ context .mode = PHP_CLI_MODE_REFLECTION_EXT_INFO ;
835
835
reflection_what = php_optarg ;
836
836
break ;
837
837
case 15 :
@@ -858,8 +858,8 @@ static int do_cli(int argc, char **argv) /* {{{ */
858
858
is essential to mitigate buggy console info. */
859
859
interactive = php_win32_console_is_own () &&
860
860
!(script_file ||
861
- argc > php_optind && context .mode != PHP_CLI_MODE_CLI_DIRECT &&
862
- context .mode != PHP_CLI_MODE_PROCESS_STDIN &&
861
+ argc > php_optind && context .mode != PHP_CLI_MODE_CLI_DIRECT &&
862
+ context .mode != PHP_CLI_MODE_PROCESS_STDIN &&
863
863
strcmp (argv [php_optind - 1 ],"--" )
864
864
);
865
865
}
@@ -879,11 +879,11 @@ static int do_cli(int argc, char **argv) /* {{{ */
879
879
/* only set script_file if not set already and not in direct mode and not at end of parameter list */
880
880
if (argc > php_optind
881
881
&& !script_file
882
- && context .mode != PHP_CLI_MODE_CLI_DIRECT
883
- && context .mode != PHP_CLI_MODE_PROCESS_STDIN
884
- && strcmp (argv [php_optind - 1 ],"--" ))
882
+ && context .mode != PHP_CLI_MODE_CLI_DIRECT
883
+ && context .mode != PHP_CLI_MODE_PROCESS_STDIN
884
+ && strcmp (argv [php_optind - 1 ],"--" ))
885
885
{
886
- script_file = argv [php_optind ];
886
+ script_file = argv [php_optind ];
887
887
php_optind ++ ;
888
888
}
889
889
if (script_file ) {
@@ -913,15 +913,15 @@ static int do_cli(int argc, char **argv) /* {{{ */
913
913
914
914
/* before registering argv to module exchange the *new* argv[0] */
915
915
/* we can achieve this without allocating more memory */
916
- SG (request_info ).argc = argc - php_optind + 1 ;
917
- arg_excp = argv + php_optind - 1 ;
918
- arg_free = argv [php_optind - 1 ];
916
+ SG (request_info ).argc = argc - php_optind + 1 ;
917
+ arg_excp = argv + php_optind - 1 ;
918
+ arg_free = argv [php_optind - 1 ];
919
919
SG (request_info ).path_translated = translated_path ? translated_path : php_self ;
920
- argv [php_optind - 1 ] = php_self ;
921
- SG (request_info ).argv = argv + php_optind - 1 ;
920
+ argv [php_optind - 1 ] = php_self ;
921
+ SG (request_info ).argv = argv + php_optind - 1 ;
922
922
SG (server_context ) = & context ;
923
923
924
- if (php_request_startup ()== FAILURE ) {
924
+ if (php_request_startup () == FAILURE ) {
925
925
* arg_excp = arg_free ;
926
926
PUTS ("Could not startup.\n" );
927
927
goto err ;
@@ -965,7 +965,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
965
965
}
966
966
break ;
967
967
case PHP_CLI_MODE_STRIP :
968
- if (open_file_for_scanning (& file_handle )== SUCCESS ) {
968
+ if (open_file_for_scanning (& file_handle ) == SUCCESS ) {
969
969
zend_strip ();
970
970
}
971
971
goto out ;
@@ -974,7 +974,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
974
974
{
975
975
zend_syntax_highlighter_ini syntax_highlighter_ini ;
976
976
977
- if (open_file_for_scanning (& file_handle )== SUCCESS ) {
977
+ if (open_file_for_scanning (& file_handle ) == SUCCESS ) {
978
978
php_get_highlight_struct (& syntax_highlighter_ini );
979
979
zend_highlight (& syntax_highlighter_ini );
980
980
}
@@ -1002,7 +1002,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
1002
1002
if (exec_begin ) {
1003
1003
zend_eval_string_ex (exec_begin , NULL , "Command line begin code" , 1 );
1004
1004
}
1005
- while (EG (exit_status ) == SUCCESS && (input = php_stream_gets (s_in_process , NULL , 0 )) != NULL ) {
1005
+ while (EG (exit_status ) == SUCCESS && (input = php_stream_gets (s_in_process , NULL , 0 )) != NULL ) {
1006
1006
len = strlen (input );
1007
1007
while (len > 0 && len -- && (input [len ]== '\n' || input [len ]== '\r' )) {
1008
1008
input [len ] = '\0' ;
@@ -1032,89 +1032,89 @@ static int do_cli(int argc, char **argv) /* {{{ */
1032
1032
break ;
1033
1033
}
1034
1034
1035
- case PHP_CLI_MODE_REFLECTION_FUNCTION :
1036
- case PHP_CLI_MODE_REFLECTION_CLASS :
1037
- case PHP_CLI_MODE_REFLECTION_EXTENSION :
1038
- case PHP_CLI_MODE_REFLECTION_ZEND_EXTENSION :
1039
- {
1040
- zend_class_entry * pce = NULL ;
1041
- zval arg , ref ;
1042
- zend_execute_data execute_data ;
1043
-
1044
- switch (context .mode ) {
1045
- default :
1046
- break ;
1047
- case PHP_CLI_MODE_REFLECTION_FUNCTION :
1048
- if (strstr (reflection_what , "::" )) {
1049
- pce = reflection_method_ptr ;
1050
- } else {
1051
- pce = reflection_function_ptr ;
1052
- }
1053
- break ;
1054
- case PHP_CLI_MODE_REFLECTION_CLASS :
1055
- pce = reflection_class_ptr ;
1056
- break ;
1057
- case PHP_CLI_MODE_REFLECTION_EXTENSION :
1058
- pce = reflection_extension_ptr ;
1059
- break ;
1060
- case PHP_CLI_MODE_REFLECTION_ZEND_EXTENSION :
1061
- pce = reflection_zend_extension_ptr ;
1062
- break ;
1063
- }
1035
+ case PHP_CLI_MODE_REFLECTION_FUNCTION :
1036
+ case PHP_CLI_MODE_REFLECTION_CLASS :
1037
+ case PHP_CLI_MODE_REFLECTION_EXTENSION :
1038
+ case PHP_CLI_MODE_REFLECTION_ZEND_EXTENSION :
1039
+ {
1040
+ zend_class_entry * pce = NULL ;
1041
+ zval arg , ref ;
1042
+ zend_execute_data execute_data ;
1064
1043
1065
- ZVAL_STRING (& arg , reflection_what );
1066
- object_init_ex (& ref , pce );
1044
+ switch (context .mode ) {
1045
+ default :
1046
+ break ;
1047
+ case PHP_CLI_MODE_REFLECTION_FUNCTION :
1048
+ if (strstr (reflection_what , "::" )) {
1049
+ pce = reflection_method_ptr ;
1050
+ } else {
1051
+ pce = reflection_function_ptr ;
1052
+ }
1053
+ break ;
1054
+ case PHP_CLI_MODE_REFLECTION_CLASS :
1055
+ pce = reflection_class_ptr ;
1056
+ break ;
1057
+ case PHP_CLI_MODE_REFLECTION_EXTENSION :
1058
+ pce = reflection_extension_ptr ;
1059
+ break ;
1060
+ case PHP_CLI_MODE_REFLECTION_ZEND_EXTENSION :
1061
+ pce = reflection_zend_extension_ptr ;
1062
+ break ;
1063
+ }
1067
1064
1068
- memset (& execute_data , 0 , sizeof (zend_execute_data ));
1069
- EG (current_execute_data ) = & execute_data ;
1070
- zend_call_known_instance_method_with_1_params (
1071
- pce -> constructor , Z_OBJ (ref ), NULL , & arg );
1065
+ ZVAL_STRING (& arg , reflection_what );
1066
+ object_init_ex (& ref , pce );
1067
+
1068
+ memset (& execute_data , 0 , sizeof (zend_execute_data ));
1069
+ EG (current_execute_data ) = & execute_data ;
1070
+ zend_call_known_instance_method_with_1_params (
1071
+ pce -> constructor , Z_OBJ (ref ), NULL , & arg );
1072
+
1073
+ if (EG (exception )) {
1074
+ zval rv ;
1075
+ zval * msg = zend_read_property_ex (zend_ce_exception , EG (exception ), ZSTR_KNOWN (ZEND_STR_MESSAGE ), /* silent */ false, & rv );
1076
+ zend_printf ("Exception: %s\n" , Z_STRVAL_P (msg ));
1077
+ zend_object_release (EG (exception ));
1078
+ EG (exception ) = NULL ;
1079
+ EG (exit_status ) = 1 ;
1080
+ } else {
1081
+ zend_print_zval (& ref , 0 );
1082
+ zend_write ("\n" , 1 );
1083
+ }
1084
+ zval_ptr_dtor (& ref );
1085
+ zval_ptr_dtor (& arg );
1072
1086
1073
- if (EG (exception )) {
1074
- zval rv ;
1075
- zval * msg = zend_read_property_ex (zend_ce_exception , EG (exception ), ZSTR_KNOWN (ZEND_STR_MESSAGE ), /* silent */ false, & rv );
1076
- zend_printf ("Exception: %s\n" , Z_STRVAL_P (msg ));
1077
- zend_object_release (EG (exception ));
1078
- EG (exception ) = NULL ;
1079
- EG (exit_status ) = 1 ;
1080
- } else {
1081
- zend_print_zval (& ref , 0 );
1082
- zend_write ("\n" , 1 );
1083
- }
1084
- zval_ptr_dtor (& ref );
1085
- zval_ptr_dtor (& arg );
1087
+ break ;
1088
+ }
1089
+ case PHP_CLI_MODE_REFLECTION_EXT_INFO :
1090
+ {
1091
+ size_t len = strlen (reflection_what );
1092
+ char * lcname = zend_str_tolower_dup (reflection_what , len );
1093
+ zend_module_entry * module ;
1086
1094
1087
- break ;
1088
- }
1089
- case PHP_CLI_MODE_REFLECTION_EXT_INFO :
1090
- {
1091
- size_t len = strlen (reflection_what );
1092
- char * lcname = zend_str_tolower_dup (reflection_what , len );
1093
- zend_module_entry * module ;
1094
-
1095
- if ((module = zend_hash_str_find_ptr (& module_registry , lcname , len )) == NULL ) {
1096
- if (!strcmp (reflection_what , "main" )) {
1097
- display_ini_entries (NULL );
1098
- } else {
1099
- zend_printf ("Extension '%s' not present.\n" , reflection_what );
1100
- EG (exit_status ) = 1 ;
1101
- }
1095
+ if ((module = zend_hash_str_find_ptr (& module_registry , lcname , len )) == NULL ) {
1096
+ if (!strcmp (reflection_what , "main" )) {
1097
+ display_ini_entries (NULL );
1102
1098
} else {
1103
- php_info_print_module (module );
1099
+ zend_printf ("Extension '%s' not present.\n" , reflection_what );
1100
+ EG (exit_status ) = 1 ;
1104
1101
}
1105
-
1106
- efree (lcname );
1107
- break ;
1102
+ } else {
1103
+ php_info_print_module (module );
1108
1104
}
1109
1105
1110
- case PHP_CLI_MODE_SHOW_INI_CONFIG :
1111
- {
1112
- zend_printf ("Configuration File (php.ini) Path: %s\n" , PHP_CONFIG_FILE_PATH );
1113
- zend_printf ("Loaded Configuration File: %s\n" , php_ini_opened_path ? php_ini_opened_path : "(none)" );
1114
- zend_printf ("Scan for additional .ini files in: %s\n" , php_ini_scanned_path ? php_ini_scanned_path : "(none)" );
1115
- zend_printf ("Additional .ini files parsed: %s\n" , php_ini_scanned_files ? php_ini_scanned_files : "(none)" );
1116
- break ;
1117
- }
1106
+ efree (lcname );
1107
+ break ;
1108
+ }
1109
+
1110
+ case PHP_CLI_MODE_SHOW_INI_CONFIG :
1111
+ {
1112
+ zend_printf ("Configuration File (php.ini) Path: %s\n" , PHP_CONFIG_FILE_PATH );
1113
+ zend_printf ("Loaded Configuration File: %s\n" , php_ini_opened_path ? php_ini_opened_path : "(none)" );
1114
+ zend_printf ("Scan for additional .ini files in: %s\n" , php_ini_scanned_path ? php_ini_scanned_path : "(none)" );
1115
+ zend_printf ("Additional .ini files parsed: %s\n" , php_ini_scanned_files ? php_ini_scanned_files : "(none)" );
1116
+ break ;
1117
+ }
1118
1118
}
1119
1119
} zend_end_try ();
1120
1120
@@ -1130,7 +1130,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
1130
1130
free (translated_path );
1131
1131
translated_path = NULL ;
1132
1132
}
1133
- if (context .mode == PHP_CLI_MODE_LINT && argc > php_optind && strcmp (argv [php_optind ],"--" )) {
1133
+ if (context .mode == PHP_CLI_MODE_LINT && argc > php_optind && strcmp (argv [php_optind ], "--" )) {
1134
1134
script_file = NULL ;
1135
1135
goto do_repeat ;
1136
1136
}
0 commit comments