Title: Fatal error: Uncaught TypeError
Last modified: January 24, 2023

---

# Fatal error: Uncaught TypeError

 *  Resolved [Seath](https://wordpress.org/support/users/seath/)
 * (@seath)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/)
 * Hello I keep getting this error when I visit the statistics page.
 *     ```wp-block-code
       Fatal error: Uncaught TypeError: burst_statistics::convert_date_to_utc(): Return value must be of type int, string returned in /wp-content/plugins/burst-statistics/statistics/class-statistics.php:665
   
       Stack Trace
       1.	
       burst_statistics->convert_date_to_utc(' 00:00:00')
       /wp-content/plugins/burst-statistics/settings/settings.php:363
       2.	
       burst_get_data(Object(WP_REST_Request))
       /wp-includes/rest-api/class-wp-rest-server.php:1171
       3.	
       WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/burst/v1/data/...', Array, NULL)
       /wp-includes/rest-api/class-wp-rest-server.php:1018
       4.	
       WP_REST_Server->dispatch(Object(WP_REST_Request))
       /wp-includes/rest-api/class-wp-rest-server.php:442
       5.	
       WP_REST_Server->serve_request('/burst/v1/data/...')
       /wp-includes/rest-api.php:410
       6.	
       rest_api_loaded(Object(WP))
       /wp-includes/class-wp-hook.php:308
       7.	
       WP_Hook->apply_filters('', Array)
       /wp-includes/class-wp-hook.php:332
       8.	
       WP_Hook->do_action(Array)
       /wp-includes/plugin.php:565
       9.	
       do_action_ref_array('parse_request', Array)
       /wp-includes/class-wp.php:399
       10.	
       WP->parse_request('')
       /wp-includes/class-wp.php:780
       11.	
       WP->main('')
       /wp-includes/functions.php:1332
       12.	
       wp()
       /wp-blog-header.php:16
       13.	
       require('/home/niowaholt...')
       /index.php:17
       14.	
       {main}
       thrown in /wp-content/plugins/burst-statistics/statistics/class-statistics.php on line 665
       ```
   

Viewing 15 replies - 1 through 15 (of 20 total)

1 [2](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/page/2/?output_format=md)

 *  Plugin Author [Rogier Lankhorst](https://wordpress.org/support/users/rogierlankhorst/)
 * (@rogierlankhorst)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/#post-16403608)
 * [@seath](https://wordpress.org/support/users/seath/) which php version are you
   using?
 * I’ve created a fix that should catch this error:
    [https://github.com/Really-Simple-Plugins/burst/tree/cast-timestamp-to-int](https://github.com/Really-Simple-Plugins/burst/tree/cast-timestamp-to-int)
 * Let me know if that resolves your issue.
 *  Thread Starter [Seath](https://wordpress.org/support/users/seath/)
 * (@seath)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/#post-16405036)
 * [@rogierlankhorst](https://wordpress.org/support/users/rogierlankhorst/)
 * PHP Version: 8.0.27
 * Sorry it didn’t worked. I am getting the same error.
 *  Plugin Author [Rogier Lankhorst](https://wordpress.org/support/users/rogierlankhorst/)
 * (@rogierlankhorst)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/#post-16405574)
 * [@seath](https://wordpress.org/support/users/seath/) I can’t reproduce the error
   yet, but I think I know where the issue is coming from: a function which converts
   dates to a Unix timestamp returns the string when the date isn’t understood, 
   but it should always return a unix int.
 * Can you try this branch again?
    [https://github.com/Really-Simple-Plugins/burst/tree/cast-timestamp-to-int](https://github.com/Really-Simple-Plugins/burst/tree/cast-timestamp-to-int)
 * What date time format do you use on your site? If I can reproduce the exact settings,
   I can test myself if the change works. Haven’t found the configuration yet.
 *  Thread Starter [Seath](https://wordpress.org/support/users/seath/)
 * (@seath)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/#post-16405595)
 * [@rogierlankhorst](https://wordpress.org/support/users/rogierlankhorst/) I am
   using F j, Y date, and g:i A time format.
 * The error changed after the last branch…
 *     ```wp-block-code
       Fatal error: Uncaught Error: Undefined constant "_IN_SECONDS" in /wp-content/plugins/burst-cast-timestamp-to-int/statistics/class-statistics.php:760
   
       Stack Trace
       1.	
       constant('_IN_SECONDS')
       /wp-content/plugins/burst-cast-timestamp-to-int/statistics/class-statistics.php:760
       2.	
       burst_statistics->get_nr_of_periods('', 1674540000, 1674626399)
       /wp-content/plugins/burst-cast-timestamp-to-int/statistics/class-statistics.php:296
       3.	
       burst_statistics->get_insights_data(Array)
       /wp-content/plugins/burst-cast-timestamp-to-int/settings/settings.php:375
       4.	
       burst_get_data(Object(WP_REST_Request))
       /wp-includes/rest-api/class-wp-rest-server.php:1171
       5.	
       WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/burst/v1/data/...', Array, NULL)
       /wp-includes/rest-api/class-wp-rest-server.php:1018
       6.	
       WP_REST_Server->dispatch(Object(WP_REST_Request))
       /wp-includes/rest-api/class-wp-rest-server.php:442
       7.	
       WP_REST_Server->serve_request('/burst/v1/data/...')
       /wp-includes/rest-api.php:410
       8.	
       rest_api_loaded(Object(WP))
       /wp-includes/class-wp-hook.php:308
       9.	
       WP_Hook->apply_filters('', Array)
       /wp-includes/class-wp-hook.php:332
       10.	
       WP_Hook->do_action(Array)
       /wp-includes/plugin.php:565
       11.	
       do_action_ref_array('parse_request', Array)
       /wp-includes/class-wp.php:399
       12.	
       WP->parse_request('')
       /wp-includes/class-wp.php:780
       13.	
       WP->main('')
       /wp-includes/functions.php:1332
       14.	
       wp()
       /wp-blog-header.php:16
       15.	
       require('/home/nownow/pu...')
       /index.php:17
       16.	
       {main}
       thrown in /wp-content/plugins/burst-cast-timestamp-to-int/statistics/class-statistics.php on line 760
       ```
   
 * And there are two warnings now….
 *     ```wp-block-code
       Warning: Trying to access array offset on value of type null in /wp-content/plugins/burst-cast-timestamp-to-int/settings/settings.php on line 374
   
       and
   
       Warning: Undefined variable $data in /wp-content/plugins/burst-cast-timestamp-to-int/statistics/class-statistics.php on line 575
       ```
   
 *  Plugin Author [Rogier Lankhorst](https://wordpress.org/support/users/rogierlankhorst/)
 * (@rogierlankhorst)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/#post-16406559)
 * [@seath](https://wordpress.org/support/users/seath/) thanks for the details bug
   reports, that helps!
 * It looks like the Rest Request that is retrieving the statistics overview does
   not receive the parameters for this specific request. In one location the fallback
   to a missing interval is not ‘day’, but ”, this results in several notices and
   errors. I’ve added fixes for that, which should fix the errors.
 * The interesting part is why the ‘interval’ array key is missing in the first 
   place. I don’t think it’s related to the date format.
 * Can you try the latest version of the above branch? The above warnings should
   be resolved, but please check if the graph (for which this request is made) is
   showing the correct range etc.
 *  Thread Starter [Seath](https://wordpress.org/support/users/seath/)
 * (@seath)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/#post-16407023)
 * [@rogierlankhorst](https://wordpress.org/support/users/rogierlankhorst/) The 
   graph is showing up but its all the way cross on 0 line. And I still getting 
   a Warning.
 *     ```wp-block-code
       Warning: Trying to access array offset on value of type null in /wp-content/plugins/burst-cast-timestamp-to-int/settings/settings.php on line 375
       ```
   
 *  Plugin Author [Rogier Lankhorst](https://wordpress.org/support/users/rogierlankhorst/)
 * (@rogierlankhorst)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/#post-16407197)
 * I have updated the above warning, missed that one.
 * In the latest version this is fixed. Possibly it caused the empty statistics 
   as well. This branch now also includes dynamic cache clearing if the cached data
   is empty.
 *  Thread Starter [Seath](https://wordpress.org/support/users/seath/)
 * (@seath)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/#post-16407284)
 * [@rogierlankhorst](https://wordpress.org/support/users/rogierlankhorst/) I’m 
   guessing the branch wasn’t updated, because the problem is still there.
 *  Plugin Author [Rogier Lankhorst](https://wordpress.org/support/users/rogierlankhorst/)
 * (@rogierlankhorst)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/#post-16407294)
 * I’m sorry you’re right, I forgot to push to github…. Done now.
 *  Thread Starter [Seath](https://wordpress.org/support/users/seath/)
 * (@seath)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/#post-16407329)
 * [@rogierlankhorst](https://wordpress.org/support/users/rogierlankhorst/) I am
   sorry to do that to you, but the graph is still on 0 and now I am getting all
   this stuff in my error file….
 *     ```wp-block-code
       Jan 25, 06:21:14
   
       Array
       (
       [date_start] => 1674626400
       [date_end] => 1674712799
       [date_range] => custom
       [metrics] => Array
       (
       )
       [interval] => day
       )
   
   
       Jan 25, 06:21:14
   
       insights args
   
   
   
       )
   
   
   
       [parsed_body:protected] =>
   
   
   
       [parsed_json:protected] => 1
   
   
   
       )
   
   
   
       )
   
   
   
       (
   
   
   
       [permission_callback] => Closure Object
   
   
   
       [callback] => burst_get_data
   
   
   
       )
   
   
   
       (
   
   
   
       [args] => Array
   
   
   
       [show_in_index] => 1
   
   
   
       [accept_raw] =>
   
   
   
       [accept_json] =>
   
   
   
       )
   
   
   
       [GET] => 1
   
   
   
       (
   
       Mark as fixed | Ignore
   
   
       [methods] => Array
       ```
   
 *  Plugin Author [Rogier Lankhorst](https://wordpress.org/support/users/rogierlankhorst/)
 * (@rogierlankhorst)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/#post-16407434)
 * [@seath](https://wordpress.org/support/users/seath/) No problem at all! I put
   those logs in there to see if the request data is correct. The logs you posted
   shows me that the metric is not there, so I’ve adjusted for that as well.
 * Thanks for taking the time to check this. It’s difficult to test otherwise!
 * I’ve pushed the latest changes to github (including the logs still, will remove
   them if we’ve resolved it).
 *  Thread Starter [Seath](https://wordpress.org/support/users/seath/)
 * (@seath)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/#post-16407466)
 * [@rogierlankhorst](https://wordpress.org/support/users/rogierlankhorst/) Ok this
   is what I am getting now….
 *     ```wp-block-code
       Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in /wp-content/plugins/burst-cast-timestamp-to-int/statistics/class-statistics.php:110
   
       Stack Trace
       1.	
       burst_statistics->sanitize_metric(Array)
       /wp-content/plugins/burst-cast-timestamp-to-int/settings/settings.php:369
       2.	
       burst_get_data(Object(WP_REST_Request))
       /wp-includes/rest-api/class-wp-rest-server.php:1171
       3.	
       WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/burst/v1/data/...', Array, NULL)
       /wp-includes/rest-api/class-wp-rest-server.php:1018
       4.	
       WP_REST_Server->dispatch(Object(WP_REST_Request))
       /wp-includes/rest-api/class-wp-rest-server.php:442
       5.	
       WP_REST_Server->serve_request('/burst/v1/data/...')
       /wp-includes/rest-api.php:410
       6.	
       rest_api_loaded(Object(WP))
       /wp-includes/class-wp-hook.php:308
       7.	
       WP_Hook->apply_filters('', Array)
       /wp-includes/class-wp-hook.php:332
       8.	
       WP_Hook->do_action(Array)
       /wp-includes/plugin.php:565
       9.	
       do_action_ref_array('parse_request', Array)
       /wp-includes/class-wp.php:399
       10.	
       WP->parse_request('')
       /wp-includes/class-wp.php:780
       11.	
       WP->main('')
       /wp-includes/functions.php:1332
       12.	
       wp()
       /wp-blog-header.php:16
       13.	
       require('/home/niowaholt...')
       /index.php:17
       14.	
       {main}
       thrown in /wp-content/plugins/burst-cast-timestamp-to-int/statistics/class-statistics.php on line 110
       ```
   
 * The stats are all gone no information at all.
 *  Plugin Author [Rogier Lankhorst](https://wordpress.org/support/users/rogierlankhorst/)
 * (@rogierlankhorst)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/#post-16407600)
 * [@seath](https://wordpress.org/support/users/seath/) sorry for that. I skipped
   a check and missed this.
 * I pushed a change that correctly sanitizes the metric data, and makes sure there’s
   a fallback.
 * I think we’re nearly there.
 *  Thread Starter [Seath](https://wordpress.org/support/users/seath/)
 * (@seath)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/#post-16407624)
 * [@rogierlankhorst](https://wordpress.org/support/users/rogierlankhorst/) The 
   graph is still on 0 line and back to this….
 *     ```wp-block-code
       Jan 25, 07:39:54
   
       Array
       (
       [date_start] => 1674626400
       [date_end] => 1674712799
       [date_range] => custom
       [metrics] => Array
       (
       [0] => visitors
       )
       [interval] => day
       )
   
   
       Jan 25, 07:39:54
   
       insights args
   
   
   
       )
   
   
   
       [parsed_body:protected] =>
   
   
   
       [parsed_json:protected] => 1
   
   
   
       )
   
   
   
       )
   
   
   
       (
   
   
   
       [permission_callback] => Closure Object
   
   
   
       [callback] => burst_get_data
   
   
   
       )
   
   
   
       (
   
   
   
       [args] => Array
   
   
   
       [show_in_index] => 1
   
   
   
       [accept_raw] =>
   
   
   
       [accept_json] =>
   
   
   
       )
   
   
   
       [GET] => 1
   
   
   
       (
   
   
   
       [methods] => Array
       ```
   
 *  Plugin Author [Rogier Lankhorst](https://wordpress.org/support/users/rogierlankhorst/)
 * (@rogierlankhorst)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/#post-16407647)
 * Ok, the logs are fine, the metric has a default now, and there’s an interval.
 * Can you try to select a default range, for example “last 7 days”, and try several
   different ranges to see if the issue is on all ranges or just some?

Viewing 15 replies - 1 through 15 (of 20 total)

1 [2](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/page/2/?output_format=md)

The topic ‘Fatal error: Uncaught TypeError’ is closed to new replies.

 * ![](https://ps.w.org/burst-statistics/assets/icon-256x256.png?rev=2672964)
 * [Burst Statistics – Simple WordPress Analytics (Google Analytics Alternative)](https://wordpress.org/plugins/burst-statistics/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/burst-statistics/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/burst-statistics/)
 * [Active Topics](https://wordpress.org/support/plugin/burst-statistics/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/burst-statistics/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/burst-statistics/reviews/)

 * 20 replies
 * 2 participants
 * Last reply from: [Seath](https://wordpress.org/support/users/seath/)
 * Last activity: [3 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-19/page/2/#post-16411060)
 * Status: resolved