Make WordPress Core

Opened 19 months ago

Closed 2 weeks ago

#61302 closed enhancement (fixed)

wp_style_loader_src() expects $_wp_admin_css_colors

Reported by: crstauf's profile crstauf Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 7.0 Priority: normal
Severity: minor Version:
Component: Bootstrap/Load Keywords: has-patch
Focuses: Cc:

Description

The function wp_style_loader_src() expects that $_wp_admin_css_colors should exist and be an array. This can create a PHP warning if the colors dependency is loaded or style_loader_src filter is used in a context where the global does not exist. Adding checks for the variable will prevent this warning.

Change History (3)

This ticket was mentioned in PR #6653 on WordPress/wordpress-develop by @crstauf.


19 months ago
#1

  • Keywords has-patch added

Add checks to prevent PHP warning in contexts where colors dependency is printed or style_loader_src is used where $_wp_admin_css_colors is not defined or not an array.

Trac ticket: https://core.trac.wordpress.org/ticket/61302#ticket

#2 @SergeyBiryukov
2 weeks ago

  • Milestone changed from Awaiting Review to 7.0

#3 @SergeyBiryukov
2 weeks ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 61388:

Script Loader: Check if $_wp_admin_css_colors is set in wp_style_loader_src().

This aims to avoid PHP warnings if the colors dependency is loaded or the style_loader_src filter is used in a context where the $_wp_admin_css_colors global does not exist.

Follow-up to [7976].

Props crstauf, petitphp, SergeyBiryukov.
Fixes #61302.

Note: See TracTickets for help on using tickets.