PHP Notice: Undefined variable: hub_id
-
Version 3.0.2 of the plugin is producing a PHP Notice on our site:
PHP Notice: Undefined variable: hub_id in /wordpress_install_dir/wp-content/plugins/gravityforms-hubspot/src/Hooks.php on line 57
Even though this is just a notice, it is actually a serious issue as the Async HubSpot Analytics Code never gets loaded as a result.
Looking through the code; the if statement is structured in a way to write less code where it sets the $hub_id var in the statement itself, and then checks its strlen(). I’ve seen and written code like this myself in the past without issues, but in this example when it gets to the strlen() part of the statement it produces the above notice.
If I restructure the code to first declare the $hub_id variable outside of the if(), the error goes away and the Async Analytics Code loads as expected.
- The topic ‘PHP Notice: Undefined variable: hub_id’ is closed to new replies.