Title: Null pointer every other day
Last modified: April 26, 2021

---

# Null pointer every other day

 *  Resolved [saens](https://wordpress.org/support/users/saens/)
 * (@saens)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/null-pointer-every-other-day/)
 * Hi,
    Since the major refactoring of your plugin I’m getting a null-pointer every
   now and then.
 *     ```
       2021-04-24T09:42:14+00:00 CRITICAL Uncaught Error: Call to a member function get_applied_coupons() on null in /home/deb/domains/domain.nl/public_html/wp-content/plugins/duracelltomi-google-tag-manager/integration/woocommerce.php:309
       Stack trace:
       #0 /home/deb/domains/domain.nl/public_html/wp-includes/class-wp-hook.php(292): gtm4wp_woocommerce_datalayer_filter_items(Array)
       #1 /home/deb/domains/domain.nl/public_html/wp-includes/plugin.php(212): WP_Hook->apply_filters(Array, Array)
       #2 /home/deb/domains/domain.nl/public_html/wp-content/plugins/duracelltomi-google-tag-manager/public/frontend.php(676): apply_filters('gtm4wp_compile_...', Array)
       #3 /home/deb/domains/domain.nl/public_html/wp-includes/class-wp-hook.php(290): gtm4wp_wp_header_begin()
       #4 /home/deb/domains/domain.nl/public_html/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters(NULL, Array)
       #5 /home/deb/domains/domain.nl/public_html/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
       #6 /home/deb/ in /home/deb/domains/domain.nl/public_html/wp-content/plugins/duracelltomi-google-tag-manager/integration/woocommerce.php op de lijn 309
       ```
   

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Thomas Geiger](https://wordpress.org/support/users/duracelltomi/)
 * (@duracelltomi)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/null-pointer-every-other-day/#post-14364025)
 * Hi,
 * Thanks for the report.
    I’ve added some extra checks that should fix this: [https://github.com/duracelltomi/gtm4wp/commit/06e13323a87c6d7e0d54b1d83962581f30c0165a](https://github.com/duracelltomi/gtm4wp/commit/06e13323a87c6d7e0d54b1d83962581f30c0165a)
 * If you can test this on your dev site, I would be grateful for any feedback.
   
   If you can not patch your live instance, you can disable “Cart content in data
   layer” option under Integration -> WooCommerce if you do not need this specific
   feature for any reason (it is not related to ecommerce tracking)
 *  Thread Starter [saens](https://wordpress.org/support/users/saens/)
 * (@saens)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/null-pointer-every-other-day/#post-14364046)
 * I would test, but I don’t know how to trigger it. It just shows in my logs every
   now and then. Can’t track it to a real user interacting with the site either,
   so maybe some bot does something.
 *  Plugin Author [Thomas Geiger](https://wordpress.org/support/users/duracelltomi/)
 * (@duracelltomi)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/null-pointer-every-other-day/#post-14364065)
 * Perhaps it is related to the CLI version of WooCommerce where one can interact
   with WooCommerce via API calls.
 * Do you have any admin user who might use an external tool to manage WooCommerce
   related tasks?
 *  Thread Starter [saens](https://wordpress.org/support/users/saens/)
 * (@saens)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/null-pointer-every-other-day/#post-14364085)
 * There’s no access afaik other than wp-admin. XML-RPC is blocked as well.
 *  Plugin Author [Thomas Geiger](https://wordpress.org/support/users/duracelltomi/)
 * (@duracelltomi)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/null-pointer-every-other-day/#post-14364098)
 * In that case I do not know how this happens 🙁
 * The patch will go live in the next plugin version (~2-3 weeks from now). Until
   then, if you see no risk, you can apply the changes on your site and check your
   logs.
 *  Thread Starter [saens](https://wordpress.org/support/users/saens/)
 * (@saens)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/null-pointer-every-other-day/#post-14364255)
 * Been digging through the server logs (instead of google analytics).
    Found someone
   doing some stuff:
 * [https://mydomain.nl/wp-content/uploads/https://mydomain.nl/wp-json/](https://mydomain.nl/wp-content/uploads/https://mydomain.nl/wp-json/)
 * Calling this myself in browser resulted in the error. After applying the patch
   it no longer shows the error.
 * Thanks!
 *  [r1baum](https://wordpress.org/support/users/r1baum/)
 * (@r1baum)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/null-pointer-every-other-day/#post-14372039)
 * Hi,
 * i had the same error in our error_logs today.
    What i see is that some kind of
   bot tried different urls and added ‘/wp-json/wp/v2/users/’ to the links. Which
   all resulted in the error above mentioned. Did some testing and adding /wp-json/
   to an existing link is enough. e.g. [https://mysite.com/category/wp-json/](https://mysite.com/category/wp-json/)-
   > 500 …
 * Hope this helps.
 * Best!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Null pointer every other day’ is closed to new replies.

 * ![](https://ps.w.org/duracelltomi-google-tag-manager/assets/icon-256x256.png?
   rev=1708451)
 * [GTM4WP - A Google Tag Manager (GTM) plugin for WordPress](https://wordpress.org/plugins/duracelltomi-google-tag-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/duracelltomi-google-tag-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/duracelltomi-google-tag-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/duracelltomi-google-tag-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/duracelltomi-google-tag-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/duracelltomi-google-tag-manager/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [r1baum](https://wordpress.org/support/users/r1baum/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/null-pointer-every-other-day/#post-14372039)
 * Status: resolved