From a5e8d3cb7e58d3eb56fa20369d673893e9f94c1d Mon Sep 17 00:00:00 2001 From: DmitryMaksimov Date: Mon, 25 Oct 2021 11:40:44 +0500 Subject: [PATCH 1/2] using SUBLANG_DEFAULT is not best choise --- win32/winutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32/winutil.c b/win32/winutil.c index 5e959307d7365..3d41873310f6a 100644 --- a/win32/winutil.c +++ b/win32/winutil.c @@ -29,7 +29,7 @@ PHP_WINUTIL_API char *php_win32_error_to_msg(HRESULT error) DWORD ret = FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&bufw, 0, NULL + NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), (LPWSTR)&bufw, 0, NULL ); if (!ret || !bufw) { From 6718780342c6113496e1df2c8acab4614a85f2f1 Mon Sep 17 00:00:00 2001 From: DmitryMaksimov Date: Mon, 25 Oct 2021 12:24:38 +0500 Subject: [PATCH 2/2] LOCALE_SYSTEM_DEFAULT is not the best choise --- ext/com_dotnet/com_extension.c | 1 + ext/com_dotnet/com_handlers.c | 4 ++-- ext/com_dotnet/com_iterator.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c index 55b3c282aee37..88feefa617b4b 100644 --- a/ext/com_dotnet/com_extension.c +++ b/ext/com_dotnet/com_extension.c @@ -245,6 +245,7 @@ PHP_MINIT_FUNCTION(com_dotnet) COM_CONST(VARCMP_GT); COM_CONST(VARCMP_NULL); COM_CONST(LOCALE_SYSTEM_DEFAULT); + COM_CONST(LOCALE_NEUTRAL); COM_CONST(NORM_IGNORECASE); COM_CONST(NORM_IGNORENONSPACE); diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c index 7f8f0e8614a79..fe1b6f257b283 100644 --- a/ext/com_dotnet/com_handlers.c +++ b/ext/com_dotnet/com_handlers.c @@ -326,7 +326,7 @@ static zend_function *com_method_get(zend_object **object_ptr, zend_string *name if (SUCCEEDED(ITypeInfo_GetTypeComp(obj->typeinfo, &comp))) { olename = php_com_string_to_olestring(name->val, name->len, obj->code_page); - lhash = LHashValOfNameSys(SYS_WIN32, LOCALE_SYSTEM_DEFAULT, olename); + lhash = LHashValOfNameSys(SYS_WIN32, LOCALE_NEUTRAL, olename); if (SUCCEEDED(ITypeComp_Bind(comp, olename, lhash, INVOKE_FUNC, &TI, &kind, &bindptr))) { switch (kind) { @@ -410,7 +410,7 @@ static int com_objects_compare(zval *object1, zval *object2) obja = CDNO_FETCH(object1); objb = CDNO_FETCH(object2); - switch (VarCmp(&obja->v, &objb->v, LOCALE_SYSTEM_DEFAULT, 0)) { + switch (VarCmp(&obja->v, &objb->v, LOCALE_NEUTRAL, 0)) { case VARCMP_LT: ret = -1; break; diff --git a/ext/com_dotnet/com_iterator.c b/ext/com_dotnet/com_iterator.c index 15e9b5df840c5..0bf4789b0ce41 100644 --- a/ext/com_dotnet/com_iterator.c +++ b/ext/com_dotnet/com_iterator.c @@ -200,7 +200,7 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int b } else { /* can we enumerate it? */ if (FAILED(IDispatch_Invoke(V_DISPATCH(&obj->v), DISPID_NEWENUM, - &IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD|DISPATCH_PROPERTYGET, + &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD|DISPATCH_PROPERTYGET, &dp, &v, NULL, NULL))) { goto fail; }