Skip to content

Commit da9df43

Browse files
committed
Merge branch 'trunk' into 64428/remove-type-attr-script-style-tags
2 parents e38b158 + 3d9fde3 commit da9df43

24 files changed

+546
-187
lines changed

src/wp-admin/includes/class-wp-filesystem-direct.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,18 @@ public function owner( $file ) {
249249
/**
250250
* Gets the permissions of the specified file or filepath in their octal format.
251251
*
252-
* FIXME does not handle errors in fileperms()
253-
*
254252
* @since 2.5.0
255253
*
256254
* @param string $file Path to the file.
257-
* @return string Mode of the file (the last 3 digits).
255+
* @return string Mode of the file (the last 3 digits), or the string "0" on failure.
258256
*/
259257
public function getchmod( $file ) {
260-
return substr( decoct( @fileperms( $file ) ), -3 );
258+
$perms = @fileperms( $file );
259+
if ( false === $perms ) {
260+
return '0';
261+
}
262+
263+
return substr( decoct( $perms ), -3 );
261264
}
262265

263266
/**

src/wp-admin/widgets-form.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@
187187

188188
// Remove old position.
189189
if ( ! isset( $_POST['delete_widget'] ) ) {
190-
foreach ( $sidebars_widgets as $sidebar_id => $sidebar ) {
191-
if ( is_array( $sidebar ) ) {
192-
$sidebars_widgets[ $sidebar_id ] = array_diff( $sidebar, array( $widget_id ) );
190+
foreach ( $sidebars_widgets as $sidebar_widget_id => $sidebar_widget ) {
191+
if ( is_array( $sidebar_widget ) ) {
192+
$sidebars_widgets[ $sidebar_widget_id ] = array_diff( $sidebar_widget, array( $widget_id ) );
193193
}
194194
}
195195

src/wp-includes/class-wp-comment-query.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -949,12 +949,12 @@ protected function get_comment_ids() {
949949
*/
950950
$clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$this ) );
951951

952-
$fields = isset( $clauses['fields'] ) ? $clauses['fields'] : '';
953-
$join = isset( $clauses['join'] ) ? $clauses['join'] : '';
954-
$where = isset( $clauses['where'] ) ? $clauses['where'] : '';
955-
$orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : '';
956-
$limits = isset( $clauses['limits'] ) ? $clauses['limits'] : '';
957-
$groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : '';
952+
$fields = $clauses['fields'] ?? '';
953+
$join = $clauses['join'] ?? '';
954+
$where = $clauses['where'] ?? '';
955+
$orderby = $clauses['orderby'] ?? '';
956+
$limits = $clauses['limits'] ?? '';
957+
$groupby = $clauses['groupby'] ?? '';
958958

959959
$this->filtered_where_clause = $where;
960960

src/wp-includes/class-wp-customize-manager.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,9 +1226,9 @@ public function import_theme_starter_content( $starter_content = array() ) {
12261226
$sidebars_widgets = isset( $starter_content['widgets'] ) && ! empty( $this->widgets ) ? $starter_content['widgets'] : array();
12271227
$attachments = isset( $starter_content['attachments'] ) && ! empty( $this->nav_menus ) ? $starter_content['attachments'] : array();
12281228
$posts = isset( $starter_content['posts'] ) && ! empty( $this->nav_menus ) ? $starter_content['posts'] : array();
1229-
$options = isset( $starter_content['options'] ) ? $starter_content['options'] : array();
1229+
$options = $starter_content['options'] ?? array();
12301230
$nav_menus = isset( $starter_content['nav_menus'] ) && ! empty( $this->nav_menus ) ? $starter_content['nav_menus'] : array();
1231-
$theme_mods = isset( $starter_content['theme_mods'] ) ? $starter_content['theme_mods'] : array();
1231+
$theme_mods = $starter_content['theme_mods'] ?? array();
12321232

12331233
// Widgets.
12341234
$max_widget_numbers = array();
@@ -1495,7 +1495,7 @@ public function import_theme_starter_content( $starter_content = array() ) {
14951495
$this->set_post_value(
14961496
$nav_menu_setting_id,
14971497
array(
1498-
'name' => isset( $nav_menu['name'] ) ? $nav_menu['name'] : $nav_menu_location,
1498+
'name' => $nav_menu['name'] ?? $nav_menu_location,
14991499
)
15001500
);
15011501
$this->pending_starter_content_settings_ids[] = $nav_menu_setting_id;
@@ -5239,10 +5239,10 @@ public function register_controls() {
52395239
'label' => __( 'Logo' ),
52405240
'section' => 'title_tagline',
52415241
'priority' => 8,
5242-
'height' => isset( $custom_logo_args[0]['height'] ) ? $custom_logo_args[0]['height'] : null,
5243-
'width' => isset( $custom_logo_args[0]['width'] ) ? $custom_logo_args[0]['width'] : null,
5244-
'flex_height' => isset( $custom_logo_args[0]['flex-height'] ) ? $custom_logo_args[0]['flex-height'] : null,
5245-
'flex_width' => isset( $custom_logo_args[0]['flex-width'] ) ? $custom_logo_args[0]['flex-width'] : null,
5242+
'height' => $custom_logo_args[0]['height'] ?? null,
5243+
'width' => $custom_logo_args[0]['width'] ?? null,
5244+
'flex_height' => $custom_logo_args[0]['flex-height'] ?? null,
5245+
'flex_width' => $custom_logo_args[0]['flex-width'] ?? null,
52465246
'button_labels' => array(
52475247
'select' => __( 'Select logo' ),
52485248
'change' => __( 'Change logo' ),

src/wp-includes/class-wp-http-requests-response.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,10 @@ public function get_cookies() {
164164
array(
165165
'name' => $cookie->name,
166166
'value' => urldecode( $cookie->value ),
167-
'expires' => isset( $cookie->attributes['expires'] ) ? $cookie->attributes['expires'] : null,
168-
'path' => isset( $cookie->attributes['path'] ) ? $cookie->attributes['path'] : null,
169-
'domain' => isset( $cookie->attributes['domain'] ) ? $cookie->attributes['domain'] : null,
170-
'host_only' => isset( $cookie->flags['host-only'] ) ? $cookie->flags['host-only'] : null,
167+
'expires' => $cookie->attributes['expires'] ?? null,
168+
'path' => $cookie->attributes['path'] ?? null,
169+
'domain' => $cookie->attributes['domain'] ?? null,
170+
'host_only' => $cookie->flags['host-only'] ?? null,
171171
)
172172
);
173173
}

src/wp-includes/class-wp-network-query.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -460,12 +460,12 @@ protected function get_network_ids() {
460460
*/
461461
$clauses = apply_filters_ref_array( 'networks_clauses', array( compact( $pieces ), &$this ) );
462462

463-
$fields = isset( $clauses['fields'] ) ? $clauses['fields'] : '';
464-
$join = isset( $clauses['join'] ) ? $clauses['join'] : '';
465-
$where = isset( $clauses['where'] ) ? $clauses['where'] : '';
466-
$orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : '';
467-
$limits = isset( $clauses['limits'] ) ? $clauses['limits'] : '';
468-
$groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : '';
463+
$fields = $clauses['fields'] ?? '';
464+
$join = $clauses['join'] ?? '';
465+
$where = $clauses['where'] ?? '';
466+
$orderby = $clauses['orderby'] ?? '';
467+
$limits = $clauses['limits'] ?? '';
468+
$groupby = $clauses['groupby'] ?? '';
469469

470470
if ( $where ) {
471471
$where = 'WHERE ' . $where;

src/wp-includes/class-wp-query.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3019,13 +3019,13 @@ public function get_posts() {
30193019
*/
30203020
$clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) );
30213021

3022-
$where = isset( $clauses['where'] ) ? $clauses['where'] : '';
3023-
$groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : '';
3024-
$join = isset( $clauses['join'] ) ? $clauses['join'] : '';
3025-
$orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : '';
3026-
$distinct = isset( $clauses['distinct'] ) ? $clauses['distinct'] : '';
3027-
$fields = isset( $clauses['fields'] ) ? $clauses['fields'] : '';
3028-
$limits = isset( $clauses['limits'] ) ? $clauses['limits'] : '';
3022+
$where = $clauses['where'] ?? '';
3023+
$groupby = $clauses['groupby'] ?? '';
3024+
$join = $clauses['join'] ?? '';
3025+
$orderby = $clauses['orderby'] ?? '';
3026+
$distinct = $clauses['distinct'] ?? '';
3027+
$fields = $clauses['fields'] ?? '';
3028+
$limits = $clauses['limits'] ?? '';
30293029
}
30303030

30313031
/**
@@ -3153,13 +3153,13 @@ public function get_posts() {
31533153
*/
31543154
$clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );
31553155

3156-
$where = isset( $clauses['where'] ) ? $clauses['where'] : '';
3157-
$groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : '';
3158-
$join = isset( $clauses['join'] ) ? $clauses['join'] : '';
3159-
$orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : '';
3160-
$distinct = isset( $clauses['distinct'] ) ? $clauses['distinct'] : '';
3161-
$fields = isset( $clauses['fields'] ) ? $clauses['fields'] : '';
3162-
$limits = isset( $clauses['limits'] ) ? $clauses['limits'] : '';
3156+
$where = $clauses['where'] ?? '';
3157+
$groupby = $clauses['groupby'] ?? '';
3158+
$join = $clauses['join'] ?? '';
3159+
$orderby = $clauses['orderby'] ?? '';
3160+
$distinct = $clauses['distinct'] ?? '';
3161+
$fields = $clauses['fields'] ?? '';
3162+
$limits = $clauses['limits'] ?? '';
31633163
}
31643164

31653165
if ( ! empty( $groupby ) ) {

src/wp-includes/class-wp-script-modules.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,9 @@ private function print_script_module( string $id ) {
461461
'id' => $id . '-js-module',
462462
);
463463

464-
$script_module = $this->registered[ $id ];
465-
$dependents = $this->get_recursive_dependents( $id );
466-
$fetchpriority = $this->get_highest_fetchpriority( array_merge( array( $id ), $dependents ) );
464+
$script_module = $this->registered[ $id ];
465+
$queued_dependents = array_intersect( $this->queue, $this->get_recursive_dependents( $id ) );
466+
$fetchpriority = $this->get_highest_fetchpriority( array_merge( array( $id ), $queued_dependents ) );
467467
if ( 'auto' !== $fetchpriority ) {
468468
$attributes['fetchpriority'] = $fetchpriority;
469469
}

src/wp-includes/class-wp-scripts.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,26 @@ class WP_Scripts extends WP_Dependencies {
2222
* Full URL with trailing slash.
2323
*
2424
* @since 2.6.0
25-
* @var string
25+
* @see wp_default_scripts()
26+
* @var string|null
2627
*/
2728
public $base_url;
2829

2930
/**
3031
* URL of the content directory.
3132
*
3233
* @since 2.8.0
33-
* @var string
34+
* @see wp_default_scripts()
35+
* @var string|null
3436
*/
3537
public $content_url;
3638

3739
/**
3840
* Default version string for scripts.
3941
*
4042
* @since 2.6.0
41-
* @var string
43+
* @see wp_default_scripts()
44+
* @var string|null
4245
*/
4346
public $default_version;
4447

@@ -118,6 +121,7 @@ class WP_Scripts extends WP_Dependencies {
118121
* List of default directories.
119122
*
120123
* @since 2.8.0
124+
* @see wp_default_scripts()
121125
* @var string[]|null
122126
*/
123127
public $default_dirs;
@@ -413,9 +417,19 @@ public function do_item( $handle, $group = false ) {
413417
$src = $this->base_url . $src;
414418
}
415419

416-
if ( ! empty( $ver ) ) {
417-
$src = add_query_arg( 'ver', $ver, $src );
420+
$query_args = array();
421+
if ( empty( $obj->ver ) && null !== $obj->ver && is_string( $this->default_version ) ) {
422+
$query_args['ver'] = $this->default_version;
423+
} elseif ( is_scalar( $obj->ver ) ) {
424+
$query_args['ver'] = (string) $obj->ver;
425+
}
426+
if ( isset( $this->args[ $handle ] ) ) {
427+
parse_str( $this->args[ $handle ], $parsed_args );
428+
if ( $parsed_args ) {
429+
$query_args = array_merge( $query_args, $parsed_args );
430+
}
418431
}
432+
$src = add_query_arg( rawurlencode_deep( $query_args ), $src );
419433

420434
/** This filter is documented in wp-includes/class-wp-scripts.php */
421435
$src = esc_url_raw( apply_filters( 'script_loader_src', $src, $handle ) );
@@ -1078,7 +1092,7 @@ private function filter_eligible_strategies( $handle, $eligible_strategies = nul
10781092
*
10791093
* @since 6.9.0
10801094
* @see self::filter_eligible_strategies()
1081-
* @see WP_Script_Modules::get_highest_fetchpriority_with_dependents()
1095+
* @see WP_Script_Modules::get_highest_fetchpriority()
10821096
*
10831097
* @param string $handle Script module ID.
10841098
* @param array<string, true> $checked Optional. An array of already checked script handles, used to avoid recursive loops.

src/wp-includes/class-wp-site-query.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -674,12 +674,12 @@ protected function get_site_ids() {
674674
*/
675675
$clauses = apply_filters_ref_array( 'sites_clauses', array( compact( $pieces ), &$this ) );
676676

677-
$fields = isset( $clauses['fields'] ) ? $clauses['fields'] : '';
678-
$join = isset( $clauses['join'] ) ? $clauses['join'] : '';
679-
$where = isset( $clauses['where'] ) ? $clauses['where'] : '';
680-
$orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : '';
681-
$limits = isset( $clauses['limits'] ) ? $clauses['limits'] : '';
682-
$groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : '';
677+
$fields = $clauses['fields'] ?? '';
678+
$join = $clauses['join'] ?? '';
679+
$where = $clauses['where'] ?? '';
680+
$orderby = $clauses['orderby'] ?? '';
681+
$limits = $clauses['limits'] ?? '';
682+
$groupby = $clauses['groupby'] ?? '';
683683

684684
if ( $where ) {
685685
$where = 'WHERE ' . $where;

0 commit comments

Comments
 (0)