Skip to content

Fix missing REMOTE_ADDR fallback in tracking rules.#33

Merged
adriaandotcom merged 1 commit into
simpleanalytics:mainfrom
paulber33:fix-issue-19-remote-addr-warning
Jun 18, 2026
Merged

Fix missing REMOTE_ADDR fallback in tracking rules.#33
adriaandotcom merged 1 commit into
simpleanalytics:mainfrom
paulber33:fix-issue-19-remote-addr-warning

Conversation

@paulber33

@paulber33 paulber33 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Prevent undefined array key warnings by safely defaulting to null.

Summary

Closes #19

Updates the excluded IP tracking rule so REMOTE_ADDR safely falls back to null when neither HTTP_X_FORWARDED_FOR nor REMOTE_ADDR is available. This prevents PHP undefined array key warnings while preserving the existing behavior of returning false when no IP address is present.

Security implications

  • No security impact
  • Has security impact - described as:

Testing

Manually reviewed and confirmed the fallback now avoids reading an undefined REMOTE_ADDR key.

Checklist

  • Linked to an issue
  • Tested
  • Asked for a review

Prevent undefined array key warnings by safely defaulting to null.

Co-authored-by: Cursor <cursoragent@cursor.com>
@adriaandotcom adriaandotcom self-requested a review June 18, 2026 12:16
@adriaandotcom adriaandotcom merged commit b82b188 into simpleanalytics:main Jun 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Undefined PHP Warning

2 participants