mirror of
https://github.com/typecho/typecho.git
synced 2025-01-16 20:18:19 +01:00
fix: remove unnecessary DOCTYPE tags (#1715)
This commit is contained in:
parent
de53b64880
commit
e3bdef645d
@ -60,6 +60,25 @@ class Message
|
||||
if (trim($this->message) == '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// remove the DOCTYPE, avoid using a regexp, so we can save memory
|
||||
$count = 0;
|
||||
while (true) {
|
||||
// Fail if there is an endless loop
|
||||
if ($count >= 10) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$pos = strpos($this->message, '<!DOCTYPE');
|
||||
if ($pos !== false) {
|
||||
$this->message = substr($this->message, 0, $pos)
|
||||
. substr($this->message, strpos($this->message, '>', $pos) + 1);
|
||||
$count ++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$parser = xml_parser_create();
|
||||
// Set XML parser to take the case of tags in to account
|
||||
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
|
||||
|
@ -93,7 +93,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) {
|
||||
* @property int $commentsPostInterval
|
||||
* @property string $commentsHTMLTagAllowed
|
||||
* @property bool $allowRegister
|
||||
* @property bool $allowXmlRpc
|
||||
* @property int $allowXmlRpc
|
||||
* @property int $postsListSize
|
||||
* @property bool $feedFullText
|
||||
* @property int $defaultCategory
|
||||
|
Loading…
x
Reference in New Issue
Block a user