File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -498,16 +498,18 @@ PW32CP const struct php_win32_cp *php_win32_cp_cli_do_setup(DWORD id)
498
498
499
499
PW32CP const struct php_win32_cp * php_win32_cp_cli_do_restore (DWORD id )
500
500
{/*{{{*/
501
- if (!id && orig_cp ) {
502
- id = orig_cp -> id ;
501
+ BOOL cli_io_restored = TRUE;
502
+
503
+ if (orig_in_cp ) {
504
+ cli_io_restored = cli_io_restored && SetConsoleCP (orig_in_cp -> id );
503
505
}
504
506
505
- if (SetConsoleCP ( orig_in_cp -> id ) && SetConsoleOutputCP ( orig_out_cp -> id ) ) {
506
- if ( orig_cp ) {
507
- return orig_cp ;
508
- } else {
509
- return php_win32_cp_set_by_id ( id );
510
- }
507
+ if (orig_out_cp ) {
508
+ cli_io_restored = cli_io_restored && SetConsoleOutputCP ( orig_out_cp -> id );
509
+ }
510
+
511
+ if ( cli_io_restored && id ) {
512
+ return php_win32_cp_set_by_id ( id );
511
513
}
512
514
513
515
return NULL ;
You can’t perform that action at this time.
0 commit comments