Skip to content

Commit 511284e

Browse files
authored
Apply suggestions from code review
Strictly speaking, a `STYLE` tag will be closed by a `STYLE` close tag. However, the CSS contents are concatenated together and the strict check for a STYLE close tag may later be invalidated by concatenation.
1 parent 7c01020 commit 511284e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/wp-includes/customize/class-wp-customize-custom-css-setting.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public function validate( $value ) {
171171
*
172172
* @see https://html.spec.whatwg.org/multipage/parsing.html#generic-raw-text-element-parsing-algorithm
173173
*/
174-
if ( preg_match( '#</style[ \\t\\f\\n\\r/>]#', $css ) ) {
174+
if ( stripos( $css, '</style' ) ) {
175175
$validity->add( 'illegal_markup', __( 'Markup is not allowed in CSS.' ) );
176176
}
177177

src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ protected function validate_custom_css( $css ) {
676676
*
677677
* @see https://html.spec.whatwg.org/multipage/parsing.html#generic-raw-text-element-parsing-algorithm
678678
*/
679-
if ( preg_match( '#</style[ \\t\\f\\n\\r/>]#', $css ) ) {
679+
if ( stripos( $css, '</style' ) ) {
680680
return new WP_Error(
681681
'rest_custom_css_illegal_markup',
682682
__( 'Markup is not allowed in CSS.' ),

0 commit comments

Comments
 (0)