$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>rest api - Call to undefined function upload_is_user_over_quota()|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

rest api - Call to undefined function upload_is_user_over_quota()

matteradmin9PV0评论

I have two different multisites:

  • www.example
  • www.example-two

On both sites, there are 5 sub-sites.

They're hosted on the same server (that I have setup myself using VirtualMin). All 10 sub-sites share the same parent theme, with different child-themes that has minor variations in them.

I've converted the sites to Gutenberg, - but whenever I upload an image, then I get this error:

The response is not a valid JSON response.

... Seen here:

In the error-log I get this error:

[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

Here is the entire stack-trace:

[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

It looks like that others are experiencing this error as well.

Does anyone know a fix or a work-around to this?

I have two different multisites:

  • www.example
  • www.example-two

On both sites, there are 5 sub-sites.

They're hosted on the same server (that I have setup myself using VirtualMin). All 10 sub-sites share the same parent theme, with different child-themes that has minor variations in them.

I've converted the sites to Gutenberg, - but whenever I upload an image, then I get this error:

The response is not a valid JSON response.

... Seen here:

In the error-log I get this error:

[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

Here is the entire stack-trace:

[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

It looks like that others are experiencing this error as well.

Does anyone know a fix or a work-around to this?

Share Improve this question edited Aug 30, 2018 at 18:12 Zeth asked Aug 30, 2018 at 6:28 ZethZeth 9282 gold badges13 silver badges43 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

In digging around this seems to be a bug with WordPress added in 4.9.8. This patch seems to have broken attachment uploads over the REST API on Multisite, because it uses a function from a file that isn't loaded for REST requests.

I've reported the bug here.

A quick and dirty fix would be to add this to your theme's functions.php file, or a simple plugin:

if ( ! function_exists( 'upload_is_user_over_quota' ) ) {
    function upload_is_user_over_quota( $echo ) {
        return false;
    }
}

The function won't do what it's supposed to do, but it will prevent the fatal error from occurring.

Post a comment

comment list (0)

  1. No comments so far