Skip to content

SLOP-45: Fix PHP 8 compatibility and undefined array keys in RemoteWiki#10

Open
tosfos wants to merge 1 commit intomasterfrom
SLOP-45-fix-php8-remotewiki
Open

SLOP-45: Fix PHP 8 compatibility and undefined array keys in RemoteWiki#10
tosfos wants to merge 1 commit intomasterfrom
SLOP-45-fix-php8-remotewiki

Conversation

@tosfos
Copy link
Contributor

@tosfos tosfos commented Feb 13, 2026

Fixes TypeError when no endpoint is passed and undefined array key notices in PHP 8.

Jira: SLOP-45

Steps to reproduce:

  1. Use parser function with no endpoint: {{#remote_version:}} — previously: validateEndpoint(string) received null → TypeError (PHP 8).
  2. getWikiApi with URL that has no path (e.g. https://example.com) — previously: undefined array key 'path'.
  3. getGenerator / getExtensionsData when API returns unexpected structure — previously: undefined array key for 'query','general','generator' or 'extensions'.

Expected: No TypeError; no undefined array key notices; empty string or safe fallback when endpoint is missing or API structure differs.

Changes:

  • validateEndpoint(?string $endPoint) so null is accepted; existing !$endPoint check returns false.
  • getWikiApi: build cache key from ($parse['host'] ?? '') . ($parse['path'] ?? '').
  • getGenerator: use $result['query']['general']['generator'] ?? ''.
  • getExtensionsData: use $result['query']['extensions'] ?? [].

- validateEndpoint: accept ?string so null endpoint (e.g. {{#remote_version:}}) does not cause TypeError
- getWikiApi: use ?? '' for parse_url host/path to avoid undefined array key when URL has no path
- getGenerator: use ?? '' when reading result['query']['general']['generator']
- getExtensionsData: use ?? [] when reading result['query']['extensions']

Co-authored-by: Cursor <cursoragent@cursor.com>
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