Make WordPress Core

Opened 20 months ago

Last modified 20 months ago

#63043 new defect (bug)

script-loader 'colors' src true invalid argument

Reported by: kkmuffme Owned by:
Priority: normal Milestone: Awaiting Review
Component: Script Loader Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

​https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/script-loader.php#L1587

<?php
$styles->add( 'colors', true, array( 'wp-admin', 'buttons' ) );

true is not a valid 2nd argument for add, string|false expected.

Change History (2)

This ticket was mentioned in ​PR #8437 on ​WordPress/wordpress-develop by ​@abcd95.


20 months ago
#1

  • Keywords has-patch added

#2 @abcd95
20 months ago

Thank you for reporting this issue.

After testing, I found that changing true to false or an empty string breaks the admin color scheme functionality.

Upon closer inspection of wp_style_loader_src(), it appears the current implementation expects $src to be a truthy value for the 'colors' handle to properly process it through parse_url(). ​See this

While technically true doesn't match the expected string|false type, it's a historical implementation detail that's working in practice. I think it's best to document this behavior rather than changing it for backward compatibility.

Version 1, edited 20 months ago by abcd95 (previous) (next) (diff)
Note: See TracTickets for help on using tickets.