aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-01-14 17:23:57 +0000
committerMario <mario@mariovavti.com>2024-01-14 17:23:57 +0000
commitb05b756148e1a1f24deaadcb0a021e77839bba43 (patch)
treebc03f94f461eb6e10cfca059186030ff08655220
parent03819abb22cd8f3c72eaa2b39f424249434f392a (diff)
downloadvolse-hubzilla-b05b756148e1a1f24deaadcb0a021e77839bba43.tar.gz
volse-hubzilla-b05b756148e1a1f24deaadcb0a021e77839bba43.tar.bz2
volse-hubzilla-b05b756148e1a1f24deaadcb0a021e77839bba43.zip
Handling HTML entities via mbstring is deprecated
-rw-r--r--Zotlabs/Module/Linkinfo.php7
-rw-r--r--include/html2bbcode.php6
-rw-r--r--include/html2plain.php5
-rw-r--r--include/oembed.php11
4 files changed, 23 insertions, 6 deletions
diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php
index 038c739d5..5c0ca32af 100644
--- a/Zotlabs/Module/Linkinfo.php
+++ b/Zotlabs/Module/Linkinfo.php
@@ -294,8 +294,11 @@ class Linkinfo extends \Zotlabs\Web\Controller {
if(empty($cp))
$cp = (preg_match('/meta.+content=["\']text\/html; charset=([^"\']+)/i', $body, $o) ? $o[1] : 'AUTO');
- $body = mb_convert_encoding($body, 'UTF-8', $cp);
- $body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8");
+ // mb_convert_encoding() is deprecated
+ //$body = mb_convert_encoding($body, 'UTF-8', $cp);
+ //$body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8");
+
+ $body = mb_encode_numericentity($cp, [0x80, 0x10FFFF, 0, ~0], 'UTF-8');
$doc = new \DOMDocument();
@$doc->loadHTML($body);
diff --git a/include/html2bbcode.php b/include/html2bbcode.php
index c928b91b1..aca3ff4f8 100644
--- a/include/html2bbcode.php
+++ b/include/html2bbcode.php
@@ -104,7 +104,11 @@ function html2bbcode($message)
$message = preg_replace('=<(\w+):(.+?)>=', '<removeme>', $message);
$message = preg_replace('=</(\w+):(.+?)>=', '</removeme>', $message);
- $message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8");
+ // mb_convert_encoding() is deprecated
+ //$message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8");
+ $message = mb_encode_numericentity($message, [0x80, 0x10FFFF, 0, ~0], 'UTF-8');
+
+
if(!$message)
return;
diff --git a/include/html2plain.php b/include/html2plain.php
index 48bbe3d9e..5cb7ee35d 100644
--- a/include/html2plain.php
+++ b/include/html2plain.php
@@ -121,7 +121,10 @@ function html2plain($html, $wraplength = 75, $compact = false)
{
$message = str_replace("\r", "", $html);
- $message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8");
+
+ // mb_convert_encoding() is deprecated
+ //$message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8");
+ $message = mb_encode_numericentity($message, [0x80, 0x10FFFF, 0, ~0], 'UTF-8');
if(!$message)
return;
diff --git a/include/oembed.php b/include/oembed.php
index fbe6a573b..a90c91641 100644
--- a/include/oembed.php
+++ b/include/oembed.php
@@ -395,7 +395,11 @@ function oembed_format_object($j){
$ret .= "<br /><a href='$embedurl' rel='oembed'>$embedurl</a>";
}
$ret.="<br style='clear:left'></span>";
- return mb_convert_encoding($ret, 'HTML-ENTITIES', mb_detect_encoding($ret));
+
+ // mb_convert_encoding() is deprecated
+ // return mb_convert_encoding($ret, 'HTML-ENTITIES', mb_detect_encoding($ret));
+ return mb_encode_numericentity($ret, [0x80, 0x10FFFF, 0, ~0], 'UTF-8');
+
}
function oembed_iframe($src,$width,$height) {
@@ -456,7 +460,10 @@ function oembed_html2bbcode($text) {
if (strpos($text, "oembed")){
// convert non ascii chars to html entities
- $html_text = mb_convert_encoding($text, 'HTML-ENTITIES', mb_detect_encoding($text));
+
+ // mb_convert_encoding() is deprecated
+ // $html_text = mb_convert_encoding($text, 'HTML-ENTITIES', mb_detect_encoding($text));
+ $html_text = mb_encode_numericentity($text, [0x80, 0x10FFFF, 0, ~0], 'UTF-8');
// If it doesn't parse at all, just return the text.