Opened 4 weeks ago
Last modified 4 weeks ago
#63563 new defect (bug)
Allow `int` type for version in `_WP_Dependency` chain
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch |
Focuses: | docs | Cc: |
Description
_WP_Dependency()->ver
, WP_Dependencies()->add()
, wp_enqueue_style()
, wp_register_style()
, wp_enqueue_script()
, and wp_register_script()
all have a dependency's version type set as string|bool|null
.
A common pattern for providing a script or style's version number is to use filemtime()
, which returns an int
. This can then be flagged by phpstan during static analysis as incorrect.
Because this is a valid way to generate a version number, and there is no part of the implementation that prevents the output of the number as a string, we should update these to support string|bool|int|null
.
Change History (1)
This ticket was mentioned in PR #8971 on WordPress/wordpress-develop by @hbhalodia.
4 weeks ago
#1
- Keywords has-patch added; needs-patch removed
Note: See
TracTickets for help on using
tickets.
Trac ticket: https://core.trac.wordpress.org/ticket/63563
int
type onWP_Dependency, WP_Dependencies
classes andwp_enqueue_script, wp_enqueue_style, wp_register_script, wp_register_style
function.