Skip to content

使用 MWeb 的 Metaweblog API 功能发布文章时,或者是使用 XmlRpc API 发布文章时,有时候会出现 parse error. not well formed 错误。附上简单的解决办法 #1823

Description

@oulvhai

描述这个 Bug

简明扼要地描述错误是什么。

使用 XmlRpc API 发布文章时,有时候会出现 parse error. not well formed 错误。

复现方式

复现的步骤:

使用 XmlRpc app (比如说 MWeb)发布带图片的文章时有可能会出现。

目前的解决办法:

修改在 typecho 源码: var/IXR/Message.php 这个文件,第 59 行,注释掉 $this->message = preg_replace('/<\?xml(.*)?\?' . '>/', '', $this->message);。换行并加上 $this->message = substr($this->message,strlen('<?xml version="1.0"?>'));。修改后完整的代码为:

       // first remove the XML declaration
        //$this->message = preg_replace('/<\?xml(.*)?\?' . '>/', '', $this->message);
        $this->message = substr($this->message,strlen('<?xml version="1.0"?>'));
        if (trim($this->message) == '') {
            return false;
        }

如图:
telegram-cloud-photo-size-5-6176823611088813794-y

期望的结果

简明扼要地描述你期望看到的结果。

现在只是简单地解决,希望新版本能用更好的方法解决这个 bug。

截图

如果可以的话,请添加截图或视频以帮助解释你的问题。

无截图

平台

  • 操作系统版本:
  • Apache/Nginx 版本:
  • 数据库版本:
  • PHP 版本:7.4.2
  • Typecho 版本:1.2.1
  • 浏览器版本:

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions