From 833a3cd05d7cc5064a327896e149bc0967648275 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 22 Oct 2005 20:27:26 +0000 Subject: [PATCH] * Avoid notice warning on edit with no User-Agent header --- RELEASE-NOTES | 1 + includes/EditPage.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index bb8e79bef1..2efccbd3fd 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -162,6 +162,7 @@ fully support the editing toolbar, but was found to be too confusing. * (bug 2981) Linktrail for Tamil (ta) * (bug 3722) Update of Arabic language (ar) Namespace changes * Wrap message page insertions in a transaction to speed up installation +* Avoid notice warning on edit with no User-Agent header === Caveats === diff --git a/includes/EditPage.php b/includes/EditPage.php index aca158c414..ec2d7495b5 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1131,9 +1131,19 @@ END } } - + /** + * Check if the browser is on a blacklist of user-agents known to + * mangle UTF-8 data on form submission. Returns true if Unicode + * should make it through, false if it's known to be a problem. + * @return bool + * @access private + */ function checkUnicodeCompliantBrowser() { global $wgBrowserBlackList; + if( empty( $_SERVER["HTTP_USER_AGENT"] ) ) { + // No User-Agent header sent? Trust it by default... + return true; + } $currentbrowser = $_SERVER["HTTP_USER_AGENT"]; foreach ( $wgBrowserBlackList as $browser ) { if ( preg_match($browser, $currentbrowser) ) { -- 2.20.1