bcgov / bcgov/GDX-Analytics-Drupal-Snowplow

PHP errors when users perform an empty search query

Open Beginner friendly
#30 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
1
Forks
3
PR merge metrics
No merged PRs in 30d

Description

> Deprecated function: explode(): Passing null to parameter #2 ($string) of type string is deprecated in handleTrackerWithSearch() (line 128 of modules/contrib/gdx_analytics_drupal_snowplow/gdx_analytics_drupal_snowplow.module).

When a user performs an empty search or visits a search path without query parameters (e.g., /search instead of /search?keys=drupal), parse_url($curr_uri, PHP_URL_QUERY) returns null because no query string exists.

> Warning: Undefined array key 1 in handleTrackerWithSearch() (line 134 of modules/contrib/gdx_analytics_drupal_snowplow/gdx_analytics_drupal_snowplow.module).

Contributor guide

Open the contributing guide

Research direction

Open modules/contrib/gdx_analytics_drupal_snowplow/gdx_analytics_drupal_snowplow.module and inspect handleTrackerWithSearch() around lines 128 and 134. Reproduce an empty search or a /search URL without query parameters, then verify the deprecated-function and undefined-array-key messages no longer occur while regular searches such as /search?keys=drupal continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
analytics
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.