[wp-trac] [WordPress Trac] #58461: WP Rest API List Categories Endpoint - Uncaught DivisionByZeroError in wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:351

WordPress Trac noreply at wordpress.org
Mon Jun 5 23:24:21 UTC 2023


#58461: WP Rest API List Categories Endpoint - Uncaught DivisionByZeroError in wp-
includes/rest-api/endpoints/class-wp-rest-terms-controller.php:351
--------------------------+------------------------------
 Reporter:  mcmwebsol     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  REST API      |     Version:  6.2.2
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------
Description changed by peterwilsoncc:

Old description:

> Going to the categories list endpoint
> /wp-json/wp/v2/categories/
> on PHP 8.0 using WP 6.2.2 running Twenty Twenty-Two theme with no plugins
> gives the following error:
>
> PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in /wp-
> includes/rest-api/endpoints/class-wp-rest-terms-controller.php:351\nStack
> trace:\n#0 /wp-includes/rest-api/class-wp-rest-server.php(1181):
> WP_REST_Terms_Controller->get_items(Object(WP_REST_Request))\n#1 /wp-
> includes/rest-api/class-wp-rest-server.php(1028):
> WP_REST_Server->respond_to_request(Object(WP_REST_Request),
> '/wp/v2/categori...', Array, NULL)\n#2 /wp-includes/rest-api/class-wp-
> rest-server.php(442):
> WP_REST_Server->dispatch(Object(WP_REST_Request))\n#3 /wp-includes/rest-
> api.php(410): WP_REST_Server->serve_request('/wp/v2/categori...')\n#4
> /wp-includes/class-wp-hook.php(308): rest_api_loaded(Object(WP))\n#5 /wp-
> includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)\n#6
> /wp-includes/plugin.php(565): WP_Hook->do_action(Array)\n#7 /wp-includes
> /class-wp.php(399): do_action_ref_array('parse_request', Array)\n#8 /wp-
> includes/class-wp.php(780): WP->parse_request('')\n#9 /wp-
> includes/functions.php(1334): WP->main('')\n#10 /wp-blog-header.php(16):
> wp()\n#11 /index.php(17): require('/nas/content/li...')\n#12 {main}\n
> thrown in /wp-includes/rest-api/endpoints/class-wp-rest-terms-
> controller.php on line 351

New description:

 Going to the categories list endpoint
 /wp-json/wp/v2/categories/
 on PHP 8.0 using WP 6.2.2 running Twenty Twenty-Two theme with no plugins
 gives the following error:


 {{{
 PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in /wp-
 includes/rest-api/endpoints/class-wp-rest-terms-controller.php:351
 Stack trace:
 #0 /wp-includes/rest-api/class-wp-rest-server.php(1181):
 WP_REST_Terms_Controller->get_items(Object(WP_REST_Request))
 #1 /wp-includes/rest-api/class-wp-rest-server.php(1028):
 WP_REST_Server->respond_to_request(Object(WP_REST_Request),
 '/wp/v2/categori...', Array, NULL)
 #2 /wp-includes/rest-api/class-wp-rest-server.php(442):
 WP_REST_Server->dispatch(Object(WP_REST_Request))
 #3 /wp-includes/rest-api.php(410):
 WP_REST_Server->serve_request('/wp/v2/categori...')
 #4 /wp-includes/class-wp-hook.php(308): rest_api_loaded(Object(WP))
 #5 /wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(, Array)
 #6 /wp-includes/plugin.php(565): WP_Hook->do_action(Array)
 #7 /wp-includes/class-wp.php(399): do_action_ref_array('parse_request',
 Array)
 #8 /wp-includes/class-wp.php(780): WP->parse_request()
 #9 /wp-includes/functions.php(1334): WP->main()
 #10 /wp-blog-header.php(16): wp()
 #11 /index.php(17): require('/nas/content/li...')
 #12 {main}
  thrown in /wp-includes/rest-api/endpoints/class-wp-rest-terms-
 controller.php on line 351
 }}}

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58461#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list