Skip to content

Commit

Permalink
Merge branch 'trunk' into try/fixing-theme-attr-injection-perf-regres…
Browse files Browse the repository at this point in the history
…sion
  • Loading branch information
felixarntz committed Oct 11, 2023
2 parents 4fb3a58 + bb4ab81 commit 0d6a8ca
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 11 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/slack-notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ jobs:
return 'first-failure';
}
// When a workflow has been restarted to fix a failure, check the previous run attempt.
if ( workflow_run.data.run_attempt > 1 ) {
// When a workflow has been restarted, check the previous run attempt. Because workflows are automatically
// restarted once and a failure on the first run is not reported, failures on the second run should not be
// considered.
if ( workflow_run.data.run_attempt > 2 ) {
const previous_run = await github.rest.actions.getWorkflowRunAttempt({
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down
6 changes: 4 additions & 2 deletions src/wp-admin/css/about.css
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@
------------------------------------------------------------------------------*/

.about__section .wp-people-group-title {
margin-bottom: calc(var(--gap) * 2);
margin-bottom: calc(var(--gap) * 2 - 10px);
text-align: center;

}
Expand All @@ -748,7 +748,7 @@
display: inline-block;
vertical-align: top;
box-sizing: border-box;
margin-bottom: var(--gap);
margin-bottom: calc(var(--gap) - 10px);
width: 25%;
text-align: center;
}
Expand Down Expand Up @@ -780,8 +780,10 @@
}

.about__section .wp-person .web {
display: block;
font-size: 1.4em;
font-weight: 600;
padding: 10px 10px 0;
text-decoration: none;
}

Expand Down
4 changes: 2 additions & 2 deletions src/wp-admin/includes/class-wp-filesystem-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,13 @@ public function find_folder( $folder ) {
}
}
} elseif ( 'direct' === $this->method ) {
$folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation.
$folder = str_replace( '\\', '/', $folder ); // Windows path sanitization.

return trailingslashit( $folder );
}

$folder = preg_replace( '|^([a-z]{1}):|i', '', $folder ); // Strip out Windows drive letter if it's there.
$folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation.
$folder = str_replace( '\\', '/', $folder ); // Windows path sanitization.

if ( isset( $this->cache[ $folder ] ) ) {
return $this->cache[ $folder ];
Expand Down
3 changes: 1 addition & 2 deletions src/wp-admin/includes/class-wp-plugins-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -1280,8 +1280,7 @@ public function single_row( $item ) {

if ( ! $compatible_php || ! $compatible_wp ) {
printf(
'<tr class="plugin-update-tr">' .
'<td colspan="%s" class="plugin-update colspanchange">' .
'<tr class="plugin-update-tr"><td colspan="%s" class="plugin-update colspanchange">',
esc_attr( $this->get_column_count() )
);

Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ function download_url( $url, $timeout = 300, $signature_verification = false ) {
$signature_verification = in_array( parse_url( $url, PHP_URL_HOST ), $signed_hostnames, true );
}

// Perform signature valiation if supported.
// Perform signature validation if supported.
if ( $signature_verification ) {
$signature = wp_remote_retrieve_header( $response, 'X-Content-Signature' );

Expand Down
3 changes: 3 additions & 0 deletions src/wp-includes/block-supports/elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ function wp_render_elements_support( $block_content, $block ) {
}

$block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
if ( ! $block_type ) {
return $block_content;
}

$element_color_properties = array(
'button' => array(
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-http-requests-response.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

/**
* Core wrapper object for a WpOrg\Requests\Response for standardisation.
* Core wrapper object for a WpOrg\Requests\Response for standardization.
*
* @since 4.6.0
*
Expand Down
63 changes: 62 additions & 1 deletion tests/phpunit/tests/block-supports/wpRenderElementsSupport.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,39 @@ public function tear_down() {
parent::tear_down();
}

/**
* Tests that block supports leaves block content alone if the block type
* isn't registered.
*
* @ticket 59578
*
* @covers ::wp_render_elements_support
*
* @return void
*/
public function test_leaves_block_content_alone_when_block_type_not_registered() {
$block = array(
'blockName' => 'test/element-block-supports',
'attrs' => array(
'style' => array(
'elements' => array(
'button' => array(
'color' => array(
'text' => 'var:preset|color|vivid-red',
'background' => '#fff',
),
),
),
),
),
);

$block_markup = '<p>Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>';
$actual = wp_render_elements_support( $block_markup, $block );

$this->assertSame( $block_markup, $actual, 'Expected to leave block content unmodified, but found changes.' );
}

/**
* Tests that elements block support applies the correct classname.
*
Expand Down Expand Up @@ -64,7 +97,7 @@ public function test_elements_block_support_class( $color_settings, $elements_st
$this->assertMatchesRegularExpression(
$expected_markup,
$actual,
'Position block wrapper markup should be correct'
'Block wrapper markup should be correct'
);
}

Expand All @@ -80,6 +113,34 @@ public function data_elements_block_support_class() {
);

return array(
// @ticket 59578
'empty block markup remains untouched' => array(
'color_settings' => array(
'button' => true,
),
'elements_styles' => array(
'button' => array( 'color' => $color_styles ),
),
'block_markup' => '',
'expected_markup' => '/^$/',
),
'empty block markup remains untouched when no block attributes' => array(
'color_settings' => array(
'button' => true,
),
'elements_styles' => null,
'block_markup' => '',
'expected_markup' => '/^$/',
),
'block markup remains untouched when block has no attributes' => array(
'color_settings' => array(
'button' => true,
),
'elements_styles' => null,
'block_markup' => '<p>Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>',
'expected_markup' => '/^<p>Hello <a href="http:\/\/www.wordpress.org\/">WordPress<\/a>!<\/p>$/',
),
// @ticket 5418
'button element styles with serialization skipped' => array(
'color_settings' => array(
'button' => true,
Expand Down

0 comments on commit 0d6a8ca

Please sign in to comment.