Skip to content

Fix PHP 8.4 deprecations and attend-event fatal error#384

Merged
dd32 merged 2 commits intotrunkfrom
fix/claude/php84-compat-and-attend-error
Mar 9, 2026
Merged

Fix PHP 8.4 deprecations and attend-event fatal error#384
dd32 merged 2 commits intotrunkfrom
fix/claude/php84-compat-and-attend-error

Conversation

@dd32
Copy link
Copy Markdown
Member

@dd32 dd32 commented Mar 9, 2026

Summary

  • Fix fatal error when non-logged-in users attend an event: wp_get_current_user() always returns a WP_User object (with ID=0 for guests), so the ! $user guard never triggered. This allowed user_id=0 to reach the Attendee constructor, throwing "invalid user id". Replaced with get_current_user_id() which properly returns 0 for guests and can be checked as falsy.

  • Fix PHP 8.4 implicit nullable type deprecations: Updated 7 instances of Type $param = null to ?Type $param = null across event.php and event-date.php to silence PHP 8.4 deprecation warnings.

Test plan

  • Verify that non-logged-in users attempting to attend an event get a 403 error instead of a fatal exception
  • Verify that logged-in users can still attend/un-attend events normally
  • Confirm no PHP 8.4 deprecation warnings for implicit nullable types

🤖 Generated with Claude Code

@dd32 dd32 force-pushed the fix/claude/php84-compat-and-attend-error branch from 4713dca to a2a56fe Compare March 9, 2026 05:10
dd32 and others added 2 commits March 9, 2026 15:11
wp_get_current_user() always returns a WP_User object (with ID=0 for
guests), so the check `! $user` never triggered. This allowed user_id=0
to reach the Attendee constructor, which throws "invalid user id".
Use get_current_user_id() and check for a falsy value instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PHP 8.4 deprecates implicit nullable types (e.g. Type $param = null).
Updated all instances to use explicit nullable syntax (?Type $param = null)
in event.php and event-date.php.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dd32 dd32 force-pushed the fix/claude/php84-compat-and-attend-error branch from a2a56fe to b6b4bd3 Compare March 9, 2026 05:11
@dd32 dd32 merged commit 325121a into trunk Mar 9, 2026
3 checks passed
@dd32 dd32 deleted the fix/claude/php84-compat-and-attend-error branch March 9, 2026 05:14
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.

1 participant