From 67100a2b9c55e5ed9126bbf28aafb54d829066df Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Mon, 6 Nov 2017 12:21:25 +0100 Subject: [PATCH] Workaround for segfaults in some buggy php encoding library versions. --- includes/db/connect_db_mysqli.inc | 4 ++-- includes/page/header.inc | 5 +++-- includes/ui/ui_input.inc | 2 +- inventory/manage/item_units.php | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/includes/db/connect_db_mysqli.inc b/includes/db/connect_db_mysqli.inc index 48b57402..a70e5926 100644 --- a/includes/db/connect_db_mysqli.inc +++ b/includes/db/connect_db_mysqli.inc @@ -135,8 +135,8 @@ function db_num_fields($result) function db_escape($value = "", $nullify = false) { global $db; - - $value = @html_entity_decode($value, ENT_QUOTES, $_SESSION['language']->encoding); + + $value = @html_entity_decode($value, ENT_QUOTES, $_SESSION['language']->encoding=='iso-8859-2' ? 'ISO-8859-1' : $_SESSION['language']->encoding); $value = html_specials_encode($value); //reset default if second parameter is skipped diff --git a/includes/page/header.inc b/includes/page/header.inc index ec80dc16..7777dae4 100644 --- a/includes/page/header.inc +++ b/includes/page/header.inc @@ -40,9 +40,10 @@ function help_url($context=null) if ($clean) $help_page_url = access_string($help_page_url, true); - return htmlspecialchars($SysPrefs->help_base_url + return html_specials_encode( + $SysPrefs->help_base_url .urlencode(strtr(ucwords($help_page_url), array(' '=>'', '/'=>'', '&'=>'And'))) - .'&ctxhelp=1&lang='.$country, ENT_QUOTES); + .'&ctxhelp=1&lang='.$country); } function send_css($css = '') diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc index 448bd8f4..054af15e 100644 --- a/includes/ui/ui_input.inc +++ b/includes/ui/ui_input.inc @@ -304,7 +304,7 @@ function button($name, $value, $title=false, $icon=false, $aspect='') if ($value == _("Delete")) // Helper during implementation $icon = ICON_DELETE; return "