首页 > typecho安装后文章页面报错,Typecho_Json未找到

typecho安装后文章页面报错,Typecho_Json未找到

Warning: arraymap() expects parameter 1 to be a valid callback, class 'TypechoJson' not found in /mnt/sdcard/www/var/Json.php on line 243

Warning: Invalid argument supplied for foreach() in /mnt/sdcard/www/var/Json.php on line 245

Warning: join(): Invalid arguments passed in /mnt/sdcard/www/var/Json.php on line 252

环境是openwrt+uhttpd+php+mysql。
什么地方出了问题?

php代码:
// treat it like a regular array

            $elements = array_map(array('Typecho_Json', '_encode'), $var);

            foreach ($elements as $element) {
                if (self::_is_error($element)) {
                    return $element;
                }
            }

            return '[' . join(',', $elements) . ']';

你的环境中没有安装 JSON 库,导致程序退而求其次使用了这个解析库,然后触发了一些遗留 BUG。错误提示很明显是说Typecho_Json这个库找不到,仔细阅读代码就可以发现这句话应该是函数本身的一个递归遍历,应该调用的是自身。解决办法就是把这个库的所有 Typecho_Json 替换成 Json

事实上你搜索一下会发现,这个文件在早前的版本中是叫 Typecho_Json 的,只是在后来的版本中改了名字,但是内部的名字忘了改回来了而已。

根据你这个问题我已经发起了一个 PullRequest 修复这个问题了:https://github.com/typecho/typecho/pull/394

【热门文章】
【热门文章】