From 5a95f0c3f3cffb19faef538affdd55a4bf7a8d4c Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 7 Feb 2022 02:10:21 +0900 Subject: [PATCH] Fix #1853 encode non-BMP characters in multilang document title and content --- modules/document/document.controller.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/document/document.controller.php b/modules/document/document.controller.php index 8b7c7a1e5..1fd83bc64 100644 --- a/modules/document/document.controller.php +++ b/modules/document/document.controller.php @@ -938,8 +938,16 @@ class documentController extends document if($source_obj->get('status') == $this->getConfigStatus('temp')) $obj->regdate = date('YmdHis'); // Fix encoding of non-BMP UTF-8 characters. - $obj->title = utf8_mbencode($obj->title); - $obj->content = utf8_mbencode($obj->content); + if (isset($extra_content)) + { + $extra_content->title = utf8_mbencode($extra_content->title); + $extra_content->content = utf8_mbencode($extra_content->content); + } + else + { + $obj->title = utf8_mbencode($obj->title); + $obj->content = utf8_mbencode($obj->content); + } // Insert data into the DB $output = executeQuery('document.updateDocument', $obj); @@ -977,8 +985,11 @@ class documentController extends document } // Inert extra vars for multi-language support of title and contents. - if($extra_content->title) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType()); - if($extra_content->content) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType()); + if (isset($extra_content)) + { + $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType()); + $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType()); + } } // Update the category if the category_srl exists.