mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fixed bug #77111 php-win.exe corrupts unicode symbols from cli parameters
This commit is contained in:
commit
00c08a2e4a
3 changed files with 47 additions and 5 deletions
|
@ -22,4 +22,5 @@ if (PHP_CLI == "yes") {
|
|||
if (PHP_CLI_WIN32 == "yes") {
|
||||
SAPI('cli_win32', 'cli_win32.c php_cli_process_title.c ps_title.c', 'php-win.exe', '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
|
||||
ADD_FLAG("LDFLAGS_CLI_WIN32", "/stack:67108864");
|
||||
ADD_FLAG("LIBS_CLI_WIN32", "shell32.lib");
|
||||
}
|
||||
|
|
|
@ -637,7 +637,7 @@ static int cli_seek_file_begin(zend_file_handle *file_handle, char *script_file,
|
|||
/* }}} */
|
||||
|
||||
/*{{{ php_cli_win32_ctrl_handler */
|
||||
#if defined(PHP_WIN32) && !defined(PHP_CLI_WIN32_NO_CONSOLE)
|
||||
#if defined(PHP_WIN32)
|
||||
BOOL WINAPI php_cli_win32_ctrl_handler(DWORD sig)
|
||||
{
|
||||
(void)php_win32_cp_cli_do_restore(orig_cp);
|
||||
|
@ -1190,12 +1190,11 @@ int main(int argc, char *argv[])
|
|||
# ifdef PHP_CLI_WIN32_NO_CONSOLE
|
||||
int argc = __argc;
|
||||
char **argv = __argv;
|
||||
# else
|
||||
# endif
|
||||
int num_args;
|
||||
wchar_t **argv_wide;
|
||||
char **argv_save = argv;
|
||||
BOOL using_wide_argv = 0;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int c;
|
||||
|
@ -1365,7 +1364,7 @@ exit_loop:
|
|||
}
|
||||
module_started = 1;
|
||||
|
||||
#if defined(PHP_WIN32) && !defined(PHP_CLI_WIN32_NO_CONSOLE)
|
||||
#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
|
||||
|
@ -1411,7 +1410,7 @@ out:
|
|||
tsrm_shutdown();
|
||||
#endif
|
||||
|
||||
#if defined(PHP_WIN32) && !defined(PHP_CLI_WIN32_NO_CONSOLE)
|
||||
#if defined(PHP_WIN32)
|
||||
(void)php_win32_cp_cli_restore();
|
||||
|
||||
if (using_wide_argv) {
|
||||
|
|
42
sapi/cli/tests/argv_mb_bug77111.phpt
Normal file
42
sapi/cli/tests/argv_mb_bug77111.phpt
Normal file
|
@ -0,0 +1,42 @@
|
|||
--TEST--
|
||||
Bug #77111 php-win.exe corrupts unicode symbols from cli parameters
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include "skipif.inc";
|
||||
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
||||
die("skip this test is for Windows platforms only");
|
||||
}
|
||||
|
||||
$php = dirname(getenv('TEST_PHP_EXECUTABLE')) . DIRECTORY_SEPARATOR . "php-win.exe";
|
||||
if (!file_exists($php)) {
|
||||
die("skip php-win.exe doesn't exist");
|
||||
}
|
||||
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$php = dirname(getenv('TEST_PHP_EXECUTABLE')) . DIRECTORY_SEPARATOR . "php-win.exe";
|
||||
|
||||
$out_fl = dirname(__FILE__) . "\\argv_bug77111.txt";
|
||||
|
||||
$argv_fl = dirname(__FILE__) . DIRECTORY_SEPARATOR . "argv_test.php";
|
||||
file_put_contents($argv_fl, "<?php file_put_contents('$out_fl', implode(' ', array_slice(\$argv, 1))); ?>");
|
||||
|
||||
`$php -n $argv_fl Ästhetik Æstetik Esthétique Estética Эстетика`;
|
||||
var_dump(file_get_contents($out_fl));
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--CLEAN--
|
||||
<?php
|
||||
$out_fl = dirname(__FILE__) . "\\argv_bug77111.txt";
|
||||
$argv_fl = dirname(__FILE__) . DIRECTORY_SEPARATOR . "argv_test.php";
|
||||
unlink($argv_fl);
|
||||
unlink($out_fl);
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(57) "Ästhetik Æstetik Esthétique Estética Эстетика"
|
||||
==DONE==
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue