调用未定义的函数UPLOAD_IS_USER_OVER_QUOTA()

时间:2018-08-30 作者:Zeth

我有两个不同的多站点:

www.example。org www.example-two。org在这两个网站上,都有5个子网站。

它们托管在同一台服务器上(我使用VirtualMin自行设置)。所有10个子网站共享相同的父主题,不同的子主题有细微的变化。

我已将这些网站转换为古腾堡-但每当我上传图像时,就会出现以下错误:

The response is not a valid JSON response.

... 此处可见:

The response is not a valid JSON response

在错误日志中,我得到以下错误:

[DATESTAMP] [fcgid:warn] [pid 12345:tid 123456789012345] [client CLIENT_IP:55472] mod_fcgid: stderr: PHP Fatal error:  Uncaught Error: Call to undefined function upload_is_user_over_quota() in /PATH/TO/FOLDER/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php:808, referer: http://EXAMPLE.ORG/wp-admin/post.php?post=30&action=edit
以下是整个堆栈跟踪:

[DATESTAMP] [fcgid:warn] [pid 12345:tid 123456789012345] [client CLIENT_IP:55472] mod_fcgid: stderr: PHP Fatal error:  Uncaught Error: Call to undefined function upload_is_user_over_quota() in /PATH/TO/FOLDER/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php:808, referer: http://EXAMPLE.ORG/wp-admin/post.php?post=30&action=edit
[DATESTAMP] [fcgid:warn] [pid 12345:tid 123456789012345] [client CLIENT_IP:55472] mod_fcgid: stderr: Stack trace:, referer: http://EXAMPLE.ORG/wp-admin/post.php?post=30&action=edit
[DATESTAMP] [fcgid:warn] [pid 12345:tid 123456789012345] [client CLIENT_IP:55472] mod_fcgid: stderr: #0 /PATH/TO/FOLDER/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php(734): WP_REST_Attachments_Controller->check_upload_size(Array), referer: http://EXAMPLE.ORG/wp-admin/post.php?post=30&action=edit
[DATESTAMP] [fcgid:warn] [pid 12345:tid 123456789012345] [client CLIENT_IP:55472] mod_fcgid: stderr: #1 /PATH/TO/FOLDER/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php(108): WP_REST_Attachments_Controller->upload_from_file(Array, Array), referer: http://EXAMPLE.ORG/wp-admin/post.php?post=30&action=edit
[DATESTAMP] [fcgid:warn] [pid 12345:tid 123456789012345] [client CLIENT_IP:55472] mod_fcgid: stderr: #2 /PATH/TO/FOLDER/wp-includes/rest-api/class-wp-rest-server.php(936): WP_REST_Attachments_Controller->create_item(Object(WP_REST_Request)), referer: http://EXAMPLE.ORG/wp-admin/post.php?post=30&action=edit
[DATESTAMP] [fcgid:warn] [pid 12345:tid 123456789012345] [client CLIENT_IP:55472] mod_fcgid: stderr: #3 /PATH/TO/FOLDER/wp-includes/rest-api/class-wp-rest-server.php(321): WP_REST_Server->dispatch(Object(WP_REST_Request)), referer: http://EXAMPLE.ORG/wp-admin/post.php?post=30&action=edit
[DATESTAMP] [fcgid:warn] [pid 12345:tid 123456789012345] [client CLIENT_IP:55472] mod_fcgid: stderr: #4 /PATH/TO/FOLDER/wp-includes/rest-api.php(266): WP_REST_Server->serve_request(\'/wp/v2/media\'), referer: http://EXAMPLE.ORG/wp-admin/post.php?post=30&action=edit
[DATESTAMP] [fcgid:warn] [pid 12345:tid 123456789012345] [client CLIENT_IP:55472] mod_fcgid: stderr: #5 /PATH/TO/FOLDER/wp-inclu in /PATH/TO/FOLDER/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php on line 808, referer: http://EXAMPLE.ORG/wp-admin/post.php?post=30&action=edit
看起来是这样的others are experiencing 此错误也是如此。

有人知道这方面的解决方法吗?

1 个回复
最合适的回答,由SO网友:Jacob Peattie 整理而成

在4.9.8中添加了WordPress,这似乎是一个bug。This patch 似乎在多站点上通过REST API上传的附件被破坏了,因为它使用了一个文件中的函数,而该文件没有为REST请求加载。

我已经报告了错误here.

一个快速而肮脏的修复方法是将其添加到主题的函数中。php文件或简单插件:

if ( ! function_exists( \'upload_is_user_over_quota\' ) ) {
    function upload_is_user_over_quota( $echo ) {
        return false;
    }
}
该函数不会执行它应该执行的操作,但它可以防止致命错误的发生。

结束

相关推荐

Php致命错误:无法将WP_REST_RESPONSE类型的对象用作wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php中

我向WordPress添加了一个自定义端点,如下所示: add_action( \'rest_api_init\', function () { register_rest_route( \'menc/v1\', \'/crosscat/(?P[\\w-]+)/(?P[\\w-]+)\', array( \'methods\' => \'GET\', \'callback\' => \'dept_cat_api\',&#x