Make WordPress Core

Opened 2 years ago

Closed 10 months ago

#61302 closed enhancement (fixed)

wp_style_loader_src() expects $_wp_admin_css_colors

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

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.


2 years 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
10 months ago

  • Milestone Awaiting Review → 7.0

#3 @SergeyBiryukov
10 months ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → 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.