Skip to content

Commit 060639e

Browse files
authored
Merge branch 'WordPress:trunk' into ticket/63692-2
2 parents fc229a4 + 857852f commit 060639e

File tree

5 files changed

+104
-19
lines changed

5 files changed

+104
-19
lines changed

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ If you are not using a package manager, see the [Node.js download page](https://
3737

3838
**Note:** WordPress currently only officially supports Node.js `20.x` and npm `10.x`.
3939

40-
You will also need [Docker](https://www.docker.com/products/docker-desktop) installed and running on your computer. Docker is the virtualization software that powers the local development environment. Docker can be installed just like any other regular application.
40+
You will also need a container environment such as [Docker Desktop](https://www.docker.com/products/docker-desktop) installed and running on your computer. The container environment is the virtualization software that powers the local development environment and can be installed just like any other regular application.
41+
42+
**Note:** WordPress currently only officially supports Docker but several container environments are available and should generally be compatible, such as [Colima](https://github.com/abiosoft/colima), [OrbStack](https://orbstack.dev/), [Podman Desktop](https://podman-desktop.io/), and [Rancher Desktop](https://rancherdesktop.io/).
4143

4244
### Development Environment Commands
4345

44-
Ensure [Docker](https://www.docker.com/products/docker-desktop) is running before using these commands.
46+
Ensure your container environment is running before using these commands.
4547

4648
#### To start the development environment for the first time
4749

@@ -97,7 +99,7 @@ npm run test:php -- --group <group name or ticket number>
9799
#### Generating a code coverage report
98100
PHP code coverage reports are [generated daily](https://github.com/WordPress/wordpress-develop/actions/workflows/test-coverage.yml) and [submitted to Codecov.io](https://app.codecov.io/gh/WordPress/wordpress-develop).
99101

100-
After the local Docker environment has [been installed and started](#to-start-the-development-environment-for-the-first-time), the following command can be used to generate a code coverage report.
102+
After the local container environment has [been installed and started](#to-start-the-development-environment-for-the-first-time), the following command can be used to generate a code coverage report.
101103

102104
```
103105
npm run test:coverage
@@ -133,15 +135,15 @@ npm run env:start
133135

134136
#### Resetting the development environment
135137

136-
The development environment can be reset. This will destroy the database and attempt to remove the pulled Docker images.
138+
The development environment can be reset. This will destroy the database and attempt to remove the pulled container images.
137139

138140
```
139141
npm run env:reset
140142
```
141143

142144
### Apple Silicon machines and old MySQL/MariaDB versions
143145

144-
Older MySQL and MariaDB Docker images do not support Apple Silicon processors (M1, M2, etc.). This is true for:
146+
Older MySQL and MariaDB container images do not support Apple Silicon processors (M1, M2, etc.). This is true for:
145147

146148
- MySQL versions 5.7 and earlier
147149
- MariaDB 5.5
@@ -155,7 +157,7 @@ services:
155157
platform: linux/amd64
156158
```
157159

158-
Additionally, the "Use Rosetta for x86/AMD64 emulation on Apple Silicon" setting in Docker needs to be disabled for this workaround.
160+
Additionally, the "Use Rosetta for x86/AMD64 emulation on Apple Silicon" setting in your container environment (if applicable) needs to be disabled for this workaround.
159161

160162
## Credentials
161163

src/wp-content/themes/twentyten/functions.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
if ( ! function_exists( 'twentyten_setup' ) ) :
5757
/**
58-
* Set up theme defaults and registers support for various WordPress features.
58+
* Sets up theme defaults and registers support for various WordPress features.
5959
*
6060
* Note that this function is hooked into the after_setup_theme hook, which runs
6161
* before the init hook. The init hook is too late for some features, such as indicating
@@ -267,7 +267,7 @@ function twentyten_setup() {
267267

268268
if ( ! function_exists( 'twentyten_admin_header_style' ) ) :
269269
/**
270-
* Style the header image displayed on the Appearance > Header admin panel.
270+
* Styles the header image displayed on the Appearance > Header admin panel.
271271
*
272272
* Referenced via add_custom_image_header() in twentyten_setup().
273273
*
@@ -293,7 +293,7 @@ function twentyten_admin_header_style() {
293293

294294
if ( ! function_exists( 'twentyten_header_image' ) ) :
295295
/**
296-
* Custom header image markup displayed.
296+
* Displays the custom header image markup.
297297
*
298298
* @since Twenty Ten 4.0
299299
*/
@@ -359,7 +359,7 @@ function twentyten_excerpt_length( $length ) {
359359

360360
if ( ! function_exists( 'twentyten_continue_reading_link' ) ) :
361361
/**
362-
* Return a "Continue Reading" link for excerpts.
362+
* Returns a "Continue Reading" link for excerpts.
363363
*
364364
* @since Twenty Ten 1.0
365365
*
@@ -371,7 +371,7 @@ function twentyten_continue_reading_link() {
371371
endif;
372372

373373
/**
374-
* Replace "[...]" with an ellipsis and twentyten_continue_reading_link().
374+
* Replaces "[...]" with an ellipsis and twentyten_continue_reading_link().
375375
*
376376
* "[...]" is appended to automatically generated excerpts.
377377
*
@@ -411,7 +411,7 @@ function twentyten_custom_excerpt_more( $output ) {
411411
add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );
412412

413413
/**
414-
* Remove inline styles printed when the gallery shortcode is used.
414+
* Removes inline styles printed when the gallery shortcode is used.
415415
*
416416
* Galleries are styled by the theme in Twenty Ten's style.css. This is just
417417
* a simple filter call that tells WordPress to not use the default styles.
@@ -620,7 +620,7 @@ function twentyten_widgets_init() {
620620
add_action( 'widgets_init', 'twentyten_widgets_init' );
621621

622622
/**
623-
* Remove the default styles that are packaged with the Recent Comments widget.
623+
* Removes the default styles that are packaged with the Recent Comments widget.
624624
*
625625
* To override this in a child theme, remove the filter and optionally add your own
626626
* function tied to the widgets_init action hook.
@@ -638,7 +638,7 @@ function twentyten_remove_recent_comments_style() {
638638

639639
if ( ! function_exists( 'twentyten_posted_on' ) ) :
640640
/**
641-
* Print HTML with meta information for the current post-date/time and author.
641+
* Prints HTML with meta information for the current post-date/time and author.
642642
*
643643
* @since Twenty Ten 1.0
644644
*/
@@ -666,7 +666,7 @@ function twentyten_posted_on() {
666666

667667
if ( ! function_exists( 'twentyten_posted_in' ) ) :
668668
/**
669-
* Print HTML with meta information for the current post (category, tags and permalink).
669+
* Prints HTML with meta information for the current post (category, tags and permalink).
670670
*
671671
* @since Twenty Ten 1.0
672672
*/
@@ -794,7 +794,7 @@ function twentyten_register_block_patterns() {
794794

795795
if ( ! function_exists( 'wp_body_open' ) ) :
796796
/**
797-
* Fire the wp_body_open action.
797+
* Fires the wp_body_open action.
798798
*
799799
* Added for backward compatibility to support pre-5.2.0 WordPress versions.
800800
*

src/wp-includes/html-api/class-wp-html-doctype-info.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
*
5151
* @since 6.7.0
5252
*
53+
* @access private
54+
*
5355
* @see WP_HTML_Processor
5456
*/
5557
class WP_HTML_Doctype_Info {

src/wp-includes/html-api/class-wp-html-processor.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,14 +1760,19 @@ private function step_in_head(): bool {
17601760
case '+META':
17611761
$this->insert_html_element( $this->state->current_token );
17621762

1763+
// All following conditions depend on "tentative" encoding confidence.
1764+
if ( 'tentative' !== $this->state->encoding_confidence ) {
1765+
return true;
1766+
}
1767+
17631768
/*
17641769
* > If the active speculative HTML parser is null, then:
17651770
* > - If the element has a charset attribute, and getting an encoding from
17661771
* > its value results in an encoding, and the confidence is currently
17671772
* > tentative, then change the encoding to the resulting encoding.
17681773
*/
17691774
$charset = $this->get_attribute( 'charset' );
1770-
if ( is_string( $charset ) && 'tentative' === $this->state->encoding_confidence ) {
1775+
if ( is_string( $charset ) ) {
17711776
$this->bail( 'Cannot yet process META tags with charset to determine encoding.' );
17721777
}
17731778

@@ -1784,8 +1789,7 @@ private function step_in_head(): bool {
17841789
if (
17851790
is_string( $http_equiv ) &&
17861791
is_string( $content ) &&
1787-
0 === strcasecmp( $http_equiv, 'Content-Type' ) &&
1788-
'tentative' === $this->state->encoding_confidence
1792+
0 === strcasecmp( $http_equiv, 'Content-Type' )
17891793
) {
17901794
$this->bail( 'Cannot yet process META tags with http-equiv Content-Type to determine encoding.' );
17911795
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
/**
3+
* Unit tests covering WP_HTML_Processor META tag handling.
4+
*
5+
* @package WordPress
6+
* @subpackage HTML-API
7+
*
8+
* @since 6.9
9+
*
10+
* @group html-api
11+
*
12+
* @coversDefaultClass WP_HTML_Processor
13+
*/
14+
class Tests_HtmlApi_WpHtmlProcessorMetaTag extends WP_UnitTestCase {
15+
/**
16+
* Data provider.
17+
*/
18+
public static function data_supported_meta_tags(): array {
19+
return array(
20+
'No attributes' => array( '<meta>' ),
21+
'Unrelated attributes' => array( '<meta not-charset="OK">' ),
22+
'Boolean charset' => array( '<meta charset>' ),
23+
'HTTP Equiv: accept' => array( '<meta http-equiv="accept" content="">' ),
24+
'HTTP Equiv: content-type, no content' => array( '<meta http-equiv="content-type">' ),
25+
'Boolean HTTP Equiv' => array( '<meta http-equiv content="">' ),
26+
);
27+
}
28+
29+
/**
30+
* Ensures that META tags correctly handle encoding confidence.
31+
*
32+
* @ticket 63738
33+
*
34+
* @dataProvider data_supported_meta_tags
35+
*/
36+
public function test_supported_meta_tag( string $html ) {
37+
$html = '<!DOCTYPE html>' . $html;
38+
$processor = new class($html) extends WP_HTML_Processor {
39+
public function __construct( $html ) {
40+
parent::__construct( $html, parent::CONSTRUCTOR_UNLOCK_CODE );
41+
}
42+
};
43+
44+
$this->assertTrue( $processor->next_tag( 'META' ) );
45+
}
46+
47+
/**
48+
* Data provider.
49+
*/
50+
public static function data_unsupported_meta_tags(): array {
51+
return array(
52+
'With charset' => array( '<meta charset="utf8">', 'Cannot yet process META tags with charset to determine encoding.' ),
53+
'With CHARSET' => array( '<meta CHARSET="utf8">', 'Cannot yet process META tags with charset to determine encoding.' ),
54+
'With http-equiv' => array( '<meta http-equiv="content-type" content="">', 'Cannot yet process META tags with http-equiv Content-Type to determine encoding.' ),
55+
'With http-equiv and content' => array( '<meta http-equiv="Content-Type" content="UTF-8">', 'Cannot yet process META tags with http-equiv Content-Type to determine encoding.' ),
56+
);
57+
}
58+
59+
/**
60+
* Ensures that unsupported encoding META tags bail.
61+
*
62+
* @ticket 63738
63+
*
64+
* @dataProvider data_unsupported_meta_tags
65+
*/
66+
public function test_unsupported_meta_tags( string $html, string $unsupported_message ) {
67+
$html = '<!DOCTYPE html>' . $html;
68+
$processor = new class($html) extends WP_HTML_Processor {
69+
public function __construct( $html ) {
70+
parent::__construct( $html, parent::CONSTRUCTOR_UNLOCK_CODE );
71+
}
72+
};
73+
74+
$this->assertFalse( $processor->next_tag( 'META' ) );
75+
$this->assertInstanceOf( WP_HTML_Unsupported_Exception::class, $processor->get_unsupported_exception() );
76+
}
77+
}

0 commit comments

Comments
 (0)