Skip to content

Conversation

@vuckro
Copy link
Contributor

@vuckro vuckro commented Aug 31, 2025

Add defensive null checks in output() method to prevent fatal errors when Slim SEO processes shortcodes before WP Ultimo is fully initialized.

  • Add null check for $this->site->get_active_site_url() call
  • Add null check for edit_site URL generation using $this->site->get_hash()
  • Add null check condition for admin link using $this->site->get_id()

Resolves errors when Current_Site_Element shortcodes are processed during early WordPress initialization phases.

Ref this PR : #179 and #159

vuckro and others added 3 commits August 31, 2025 16:54
Add defensive null checks in output() method to prevent fatal errors
when Slim SEO processes shortcodes before WP Ultimo is fully initialized.

- Add null check for $this->site->get_active_site_url() call
- Add null check for edit_site URL generation using $this->site->get_hash()
- Add null check condition for admin link using $this->site->get_id()

Resolves errors when Current_Site_Element shortcodes are processed
during early WordPress initialization phases.
Added Composer patch to suppress ArrayAccess deprecation notices:
- offsetSet() - Add #[\ReturnTypeWillChange] attribute
- offsetGet() - Add #[\ReturnTypeWillChange] attribute
- offsetExists() - Add #[\ReturnTypeWillChange] attribute

This maintains backward compatibility while eliminating PHP 8+ warnings.
- Added ensure_setup() method to Base_Element class
- Call ensure_setup() in all UI element output() methods
- Remove _doing_it_wrong() errors, return empty string silently instead
- Ensures compatibility when elements are processed during SEO operations

This prevents setup() errors while maintaining defensive behavior.
Copy link
Collaborator

@superdav42 superdav42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thanks

@superdav42 superdav42 merged commit 42c13cb into Multisite-Ultimate:main Sep 3, 2025
18 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.

2 participants