Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sapi/cli/cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ typedef struct php_cli_server_context {
} php_cli_server_context;

/* this performs full cli-SAPI boot, loads modules, sets up TSRM and co. */
/* On Windows, custom argv must use PHP's internal encoding (UTF-8 by default). */
extern PHP_CLI_API int do_php_cli(int argc, char *argv[]);

#endif /* CLI_H */
16 changes: 10 additions & 6 deletions sapi/cli/php_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -1333,12 +1333,16 @@ PHP_CLI_API int do_php_cli(int argc, char *argv[])
#if defined(PHP_WIN32)
php_win32_cp_cli_setup();
orig_cp = (php_win32_cp_get_orig())->id;
/* Ignore the delivered argv and argc, read from W API. This place
might be too late though, but this is the earliest place ATW
we can access the internal charset information from PHP. */
argv_wide = CommandLineToArgvW(GetCommandLineW(), &num_args);
PHP_WIN32_CP_W_TO_ANY_ARRAY(argv_wide, num_args, argv, argc)
using_wide_argv = 1;
/* Embedders supply their own arguments, we mustn't replace them with
* the ones by the host process command line. */
if (argv_save == __argv) {
/* Ignore the delivered argv and argc, read from W API. This place
might be too late though, but this is the earliest place ATW
we can access the internal charset information from PHP. */
argv_wide = CommandLineToArgvW(GetCommandLineW(), &num_args);
PHP_WIN32_CP_W_TO_ANY_ARRAY(argv_wide, num_args, argv, argc)
using_wide_argv = 1;
}

SetConsoleCtrlHandler(php_cli_win32_ctrl_handler, TRUE);
#endif
Expand Down
Loading