Opened 6 weeks ago
Closed 4 weeks ago
#64174 closed defect (bug) (wontfix)
deprecation notice for conditional scripts
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 6.9 |
| Component: | Script Loader | Keywords: | |
| Focuses: | javascript, css | Cc: |
Description (last modified by )
WordPress 6.9 beta 2, php 8.3
If is defined in wp-config.php:
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true );
I get a php warning:
PHP Deprecated: Function WP_Dependencies->add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers. in /.../wp-includes/functions.php on line 6131
Change History (8)
#1
@
6 weeks ago
- Description modified (diff)
- Focuses php-compatibility removed
- Keywords close added
- Summary changed from WP_DEBUG and WP_DEBUG_LOG to deprecation notice for conditional scripts
#2
@
5 weeks ago
- Keywords 2nd-opinion added; close removed
I have not found any other complaints yet, but I want to suggest keeping the deprecation notices until one of the late release candidates.
That way, more theme and plugin authors can know that scripts should not have the conditional argument (or depend on such scripts). However, if the script registration is not changed before general release, removing the notice could avoid adding noise for end users who check their sites with debug before updating (and for the extenders who have higher-priority issues to fix).
#3
@
4 weeks ago
I saw the same issue -- it seems to be caused by some of the older themes, possibly twentyeleven through twentyseventeen. For example, a few lines in twentyseventeen's functions.php:
wp_style_add_data( 'twentyseventeen-ie9', 'conditional', 'IE 9' );
wp_style_add_data( 'twentyseventeen-ie8', 'conditional', 'lt IE 9' );
wp_script_add_data( 'html5', 'conditional', 'lt IE 9' );
The message occurs when viewing the front end. When I switch to a newer theme like twentytwentyfour, the deprecation message is not logged.
#4
@
4 weeks ago
It's my test page and I don't always work on it. I just made the updates (WP 6.9 beta 4). When I tested it now, there is no warning anymore. The active theme is GeneratePress. The oldest installed theme is Twenty Twenty-One.
#5
@
4 weeks ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to 6.9
T13, T15 and T17 stopped enqueueing the conditional scripts two years ago (#56699), and T11 did not enqueue any of them. If you update T12, T14 or T16 before updating WordPress, you should not have the conditional scripts enqueued because of #58836. However, child themes of any of these might enqueue the scripts. Plus many other classic themes could have conditional scripts, with or without a child theme.
@edge22 added comment:44:ticket:63821, suggesting
Maybe it's better handled silently (or logged only when
SCRIPT_DEBUGis enabled), instead of surfacing as a_doing_it_wrong()notice.
#6
@
4 weeks ago
- Focuses javascript css added
I've been going back and forth on this, and will probably continue to.
Ultimately, I don't think it's wise to suppress the errors and silently deprecate as it's very important developers be aware that their scripts and styles are not been enqueued if they have IE conditional data.
Only calling _deprecated_argument() if SCRIPT_DEBUG is enabled would be problematic for development plugins, such as Query Monitor, as the notice would be suppressed from them too as they typically use the deprecated_argument_run hook to collect messages.
If deprecated_argument_trigger_error and related filters passed the $function_name, $version, $message = '' arguments, it might be possible to use SCRIPT_DEBUG on the filter but it's a little too late to add that for the 6.9 cycle.
tl;dr: I think it's best to close this ticket as unplanned/wontfix.
#7
@
4 weeks ago
- Keywords close added
My thoughts are aligned with @peterwilsoncc on this. I think the benefit of notifying developers and helping them use modern best practices is more important than unexpected output because some sites have error display enabled.
I would also be in favor of closing this as wontfix.
#8
@
4 weeks ago
- Component changed from General to Script Loader
- Keywords 2nd-opinion needs-patch close removed
- Milestone 6.9 deleted
- Resolution set to wontfix
- Status changed from new to closed
Thanks everyone for the discussion on this one!
I agree that these notices should not be suppressed. Going to close this one out.
The message is intentionally added to tell theme and plugin developers that core deprecated the 'conditional' argument for scripts and styles in #63821. When the active theme and/or a plugin registers an outdated script,
WP_DEBUGwill show or log the message.I'll use the 'close' keyword but leave the ticket open. According to comment:29:ticket:63821