php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #73870
Patch fix_get_codepage revision 2017-01-05 10:49 UTC by jean-baptiste at nahan dot fr

Patch fix_get_codepage for Reproducible crash Bug #73870

Patch version 2017-01-05 10:49 UTC

Return to Bug #73870 | Download this patch
Patch Revisions:

Developer: jean-baptiste@nahan.fr

From 5ecc088240acffd3988dd5aef17190bd994f046a Mon Sep 17 00:00:00 2001
From: macintoshplus <jean-baptiste@nahan.fr>
Date: Thu, 5 Jan 2017 11:28:29 +0100
Subject: [PATCH] fix get codepage in service context

---
 win32/codepage.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/win32/codepage.c b/win32/codepage.c
index cddd946..161138e 100644
--- a/win32/codepage.c
+++ b/win32/codepage.c
@@ -389,6 +389,9 @@ PW32CP const struct php_win32_cp *php_win32_cp_do_setup(const char *enc)
 
 	if (!strcmp(sapi_module.name, "cli")) {
 		orig_cp = php_win32_cp_get_by_id(GetConsoleCP());
+		if (orig_cp == NULL) {
+			orig_cp = php_win32_cp_get_by_id(GetACP());
+		}
 	} else {
 		orig_cp = php_win32_cp_get_by_id(GetACP());
 	}
-- 
2.7.1.windows.2

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Feb 21 02:01:28 2024 UTC