Skip to content

Fix black colour defaults + license-helper PHP warning - #9

Merged
vapvarun merged 1 commit into
masterfrom
fix/color-defaults-and-license-warning
Aug 29, 2026
Merged

Fix black colour defaults + license-helper PHP warning#9
vapvarun merged 1 commit into
masterfrom
fix/color-defaults-and-license-warning

Conversation

@vapvarun

Copy link
Copy Markdown
Member

Fixes two Bugs-column cards on woo.local (branch @ latest, v1.3.1).

Card 10251759307 - Button colour pickers default to black on fresh install

Root cause: On the Button Style tab, the four colour inputs (background, hover background, border, hover text) fell back to '' when infinite_loader_admin_button_option had no saved value. A native <input type="color"> paints #000000 on an empty value, so a fresh install rendered black pickers - and the shop Load More button - instead of the documented brand colours.

Fix: Each colour input now falls back to the same default the shop button actually renders (#1d76da background, #0e4da0 hover background, #1d76da border, #ffffff hover text - sourced from the activator seed, the public render, and the JS "Default" buttons, which all already agreed). The stale data-default="#000"/data-color="#000" on the border picker was aligned to #1d76da to match.

Seam sweep: The sibling Load Previous button tab carried the identical empty-fallback bug on the same four fields (its hover-text even fell back to #000); fixed there too.

Evidence (woo.local, option unset):

  • Before: bg #000000, hover-bg #000000, border #000000, hover-text #000000
  • After: bg #1d76da, hover-bg #0e4da0, border #1d76da, hover-text #ffffff

Card 10251759327 - License-helper PHP warning

Root cause: edd_infinite_loader_active_license_message() only returned an array on plugins.php / index.php / page=wbcom-license-page, returning null (and false on WP error) elsewhere. Its renderer is hooked to the shared wbcom_add_plugin_license_code action, so any other admin page that renders the section hit $license_output['message'] on null:
PHP Warning: Trying to access array offset on value of type null in edd-license/edd-plugin-license.php on line 428

Fix: The helper now always returns a well-formed array (message string + license_data object carrying a license property) on every path - off-page, WP-error, and success - so any consumer of the shared hook reads it without a warning. The EDD/SL license integration is left fully intact (no item_id/item_name changes, no EDD removal). Also collapsed the duplicated is_wp_error branch and guarded a non-object json_decode result.

Evidence (woo.local, WP_DEBUG_LOG on, rendered via the production hook on a non-license page):

  • Before: line 428 null-offset warning in debug.log
  • After: section renders identically (2774 bytes), zero license-helper warnings

Verification

  • bash bin/build-release.sh green (version agreement, PHP lint, build-freshness, artifact file assertions) - PHP-only change, no bundle rebuild needed.
  • Browser-verified per tab; saved-value path unchanged (Load Previous tab with saved colours still shows them - no regression).

Card 10251759307 - Button colour pickers default to black on fresh install:
the four colour inputs (background, hover background, border, hover text) fell
back to an empty string when infinite_loader_admin_button_option had no saved
value, and a native input type=color paints black on an empty value. They now
fall back to the same documented defaults the shop button actually renders
(#1d76da / #0e4da0 / #1d76da / #ffffff), so a fresh install shows the intended
colours in the pickers and on the Load More button. Fixed the identical bug on
the sibling Load Previous button tab (its hover-text even fell back to #000),
and aligned the border picker's stale data-default/data-color (#000 -> #1d76da).

Card 10251759327 - License-helper PHP warning: edd_infinite_loader_active_license_message()
returned null on any admin page that is not plugins.php / index.php /
wbcom-license-page, but the renderer (hooked to the shared
wbcom_add_plugin_license_code action) always reads $license_output['message'],
producing "Trying to access array offset on value of type null ... line 428".
The helper now always returns a well-formed array (message + license_data object
with a license property) on every path, so any consumer of the shared hook can
read it without a warning. EDD/SL license integration is left fully intact.
@vapvarun
vapvarun merged commit f06fb85 into master Aug 29, 2026
7 checks passed
@vapvarun
vapvarun deleted the fix/color-defaults-and-license-warning branch August 29, 2026 07:16
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