diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-11-12 16:43:57 +0100 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-11-12 16:43:57 +0100 |
commit | 1e0610fe243fcfafd23ff821129cf4f35148ac64 (patch) | |
tree | 2089958de552235be618c4e732b5edbe8faf2e87 /win32 | |
parent | be2985335305f921599cfdd25b7830ded1ca395e (diff) | |
parent | a08a2b48b489572db89940027206020ee714afa5 (diff) | |
download | php-git-1e0610fe243fcfafd23ff821129cf4f35148ac64.tar.gz |
Merge branch 'PHP-8.0'
* PHP-8.0:
Strip trailing line breaks and periods from Windows error messages
Diffstat (limited to 'win32')
-rw-r--r-- | win32/winutil.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/win32/winutil.c b/win32/winutil.c index 530dc4f0f6..a14416a6ce 100644 --- a/win32/winutil.c +++ b/win32/winutil.c @@ -24,7 +24,7 @@ PHP_WINUTIL_API char *php_win32_error_to_msg(HRESULT error) {/*{{{*/ - wchar_t *bufw = NULL; + wchar_t *bufw = NULL, *pw; char *buf; DWORD ret = FormatMessageW( @@ -36,6 +36,10 @@ PHP_WINUTIL_API char *php_win32_error_to_msg(HRESULT error) return ""; } + /* strip trailing line breaks and periods */ + for (pw = bufw + wcslen(bufw) - 1; pw >= bufw && (*pw == L'\r' || *pw == L'\n' || *pw == L'.'); pw--); + pw[1] = L'\0'; + buf = php_win32_cp_conv_w_to_any(bufw, ret, PHP_WIN32_CP_IGNORE_LEN_P); LocalFree(bufw); |