summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.git-blame-ignore-revs3
-rw-r--r--src/wp-content/themes/twentytwenty/functions.php6
-rw-r--r--src/wp-includes/comment-template.php8
-rw-r--r--src/wp-includes/comment.php29
-rw-r--r--src/wp-includes/kses.php28
-rw-r--r--src/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php11
-rw-r--r--tests/phpunit/tests/rest-api/rest-application-passwords-controller.php43
-rw-r--r--tests/qunit/fixtures/wp-api-generated.js26
8 files changed, 124 insertions, 30 deletions
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index 77c4e990b0..054a175385 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -59,3 +59,6 @@ a96fa164b00ed51c7c0481574834cff92ab9b1f0 # [60043]
1aa6da693ad739b78752a55d154cd48cb757b90b # [60047]
d44e1c2ce2dc638e89ed6a1d02b1cfadb8a15fe7 # [60048]
a18719e7ea49ab7ac0091e076840cb7efdf51cc5 # [60049]
+
+# 6.9 Coding Standards
+cbb6519119276ceba4279eaee73ab66294ebd820 # [60402]
diff --git a/src/wp-content/themes/twentytwenty/functions.php b/src/wp-content/themes/twentytwenty/functions.php
index 96945243fa..a3ca940c4d 100644
--- a/src/wp-content/themes/twentytwenty/functions.php
+++ b/src/wp-content/themes/twentytwenty/functions.php
@@ -361,7 +361,11 @@ if ( ! function_exists( 'wp_body_open' ) ) {
* @since Twenty Twenty 1.0
*/
function wp_body_open() {
- /** This action is documented in wp-includes/general-template.php */
+ /**
+ * Triggered after the opening <body> tag.
+ *
+ * @since Twenty Twenty 1.0
+ */
do_action( 'wp_body_open' );
}
}
diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php
index f74249c81b..59f89f3a84 100644
--- a/src/wp-includes/comment-template.php
+++ b/src/wp-includes/comment-template.php
@@ -834,12 +834,8 @@ function get_comment_link( $comment = null, $args = array() ) {
if ( $cpage && get_option( 'page_comments' ) ) {
if ( $wp_rewrite->using_permalinks() ) {
- if ( $cpage ) {
- $comment_link = trailingslashit( $comment_link ) . $wp_rewrite->comments_pagination_base . '-' . $cpage;
- }
-
- $comment_link = user_trailingslashit( $comment_link, 'comment' );
- } elseif ( $cpage ) {
+ $comment_link = trailingslashit( $comment_link ) . $wp_rewrite->comments_pagination_base . '-' . $cpage;
+ } else {
$comment_link = add_query_arg( 'cpage', $cpage, $comment_link );
}
}
diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
index 9bd6fb2171..aabe9f60db 100644
--- a/src/wp-includes/comment.php
+++ b/src/wp-includes/comment.php
@@ -3060,22 +3060,19 @@ function do_trackbacks( $post ) {
$post_title = apply_filters( 'the_title', $post->post_title, $post->ID );
$post_title = strip_tags( $post_title );
- if ( $to_ping ) {
- foreach ( (array) $to_ping as $tb_ping ) {
- $tb_ping = trim( $tb_ping );
- if ( ! in_array( $tb_ping, $pinged, true ) ) {
- trackback( $tb_ping, $post_title, $excerpt, $post->ID );
- $pinged[] = $tb_ping;
- } else {
- $wpdb->query(
- $wpdb->prepare(
- "UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s,
- '')) WHERE ID = %d",
- $tb_ping,
- $post->ID
- )
- );
- }
+ foreach ( (array) $to_ping as $tb_ping ) {
+ $tb_ping = trim( $tb_ping );
+ if ( ! in_array( $tb_ping, $pinged, true ) ) {
+ trackback( $tb_ping, $post_title, $excerpt, $post->ID );
+ $pinged[] = $tb_ping;
+ } else {
+ $wpdb->query(
+ $wpdb->prepare(
+ "UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d",
+ $tb_ping,
+ $post->ID
+ )
+ );
}
}
}
diff --git a/src/wp-includes/kses.php b/src/wp-includes/kses.php
index ebb4a761b1..28bbce222a 100644
--- a/src/wp-includes/kses.php
+++ b/src/wp-includes/kses.php
@@ -2083,18 +2083,38 @@ function wp_kses_normalize_entities3( $matches ) {
/**
* Determines if a Unicode codepoint is valid.
*
+ * The definition of a valid Unicode codepoint is taken from the XML definition:
+ *
+ * > Characters
+ * >
+ * > …
+ * > Legal characters are tab, carriage return, line feed, and the legal characters of
+ * > Unicode and ISO/IEC 10646.
+ * > …
+ * > Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
+ *
* @since 2.7.0
*
+ * @see https://www.w3.org/TR/xml/#charsets
+ *
* @param int $i Unicode codepoint.
* @return bool Whether or not the codepoint is a valid Unicode codepoint.
*/
function valid_unicode( $i ) {
$i = (int) $i;
- return ( 0x9 === $i || 0xa === $i || 0xd === $i ||
- ( 0x20 <= $i && $i <= 0xd7ff ) ||
- ( 0xe000 <= $i && $i <= 0xfffd ) ||
- ( 0x10000 <= $i && $i <= 0x10ffff )
+ return (
+ 0x9 === $i || // U+0009 HORIZONTAL TABULATION (HT)
+ 0xA === $i || // U+000A LINE FEED (LF)
+ 0xD === $i || // U+000D CARRIAGE RETURN (CR)
+ /*
+ * The valid Unicode characters according to the XML specification:
+ *
+ * > any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
+ */
+ ( 0x20 <= $i && $i <= 0xD7FF ) ||
+ ( 0xE000 <= $i && $i <= 0xFFFD ) ||
+ ( 0x10000 <= $i && $i <= 0x10FFFF )
);
}
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php
index b0ac65a647..767917d6f6 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php
@@ -802,7 +802,16 @@ class WP_REST_Application_Passwords_Controller extends WP_REST_Controller {
'app_id' => array(
'description' => __( 'A UUID provided by the application to uniquely identify it. It is recommended to use an UUID v5 with the URL or DNS namespace.' ),
'type' => 'string',
- 'format' => 'uuid',
+ 'oneOf' => array(
+ array(
+ 'type' => 'string',
+ 'format' => 'uuid',
+ ),
+ array(
+ 'type' => 'string',
+ 'enum' => array( '' ),
+ ),
+ ),
'context' => array( 'view', 'edit', 'embed' ),
),
'name' => array(
diff --git a/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php b/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php
index 7a06bb006d..060a5c0912 100644
--- a/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php
@@ -848,6 +848,49 @@ class WP_Test_REST_Application_Passwords_Controller extends WP_Test_REST_Control
}
/**
+ * @ticket 53692
+ */
+ public function test_create_item_with_empty_app_id() {
+ wp_set_current_user( self::$admin );
+
+ $request = new WP_REST_Request( 'POST', '/wp/v2/users/me/application-passwords' );
+ $request->set_body_params(
+ array(
+ 'name' => 'Test',
+ 'app_id' => '',
+ )
+ );
+
+ $response = rest_get_server()->dispatch( $request );
+ $data = $response->get_data();
+
+ $this->assertSame( 201, $response->get_status() );
+ $this->assertSame( '', $data['app_id'] );
+ }
+
+ /**
+ * @ticket 53692
+ */
+ public function test_create_item_with_uuid_app_id() {
+ wp_set_current_user( self::$admin );
+
+ $uuid = wp_generate_uuid4();
+ $request = new WP_REST_Request( 'POST', '/wp/v2/users/me/application-passwords' );
+ $request->set_body_params(
+ array(
+ 'name' => 'Test',
+ 'app_id' => $uuid,
+ )
+ );
+
+ $response = rest_get_server()->dispatch( $request );
+ $data = $response->get_data();
+
+ $this->assertSame( 201, $response->get_status() );
+ $this->assertSame( $uuid, $data['app_id'] );
+ }
+
+ /**
* Checks the password response matches the expected format.
*
* @since 5.6.0
diff --git a/tests/qunit/fixtures/wp-api-generated.js b/tests/qunit/fixtures/wp-api-generated.js
index 72c3c1dc8b..6626758a8a 100644
--- a/tests/qunit/fixtures/wp-api-generated.js
+++ b/tests/qunit/fixtures/wp-api-generated.js
@@ -10053,7 +10053,18 @@ mockedApiResponse.Schema = {
"app_id": {
"description": "A UUID provided by the application to uniquely identify it. It is recommended to use an UUID v5 with the URL or DNS namespace.",
"type": "string",
- "format": "uuid",
+ "oneOf": [
+ {
+ "type": "string",
+ "format": "uuid"
+ },
+ {
+ "type": "string",
+ "enum": [
+ ""
+ ]
+ }
+ ],
"required": false
},
"name": {
@@ -10137,7 +10148,18 @@ mockedApiResponse.Schema = {
"app_id": {
"description": "A UUID provided by the application to uniquely identify it. It is recommended to use an UUID v5 with the URL or DNS namespace.",
"type": "string",
- "format": "uuid",
+ "oneOf": [
+ {
+ "type": "string",
+ "format": "uuid"
+ },
+ {
+ "type": "string",
+ "enum": [
+ ""
+ ]
+ }
+ ],
"required": false
},
"name": {