Make WordPress Core


Ignore:
Timestamp:
06/10/2020 06:11:24 PM (6 years ago)
Author:
desrosj
Message:

General: Backport several commits for release.

  • Embeds: Ensure that the title attribute is set correctly on embeds.
  • Editor: Prevent HTML decoding on by setting the proper editor context.
  • Formatting: Ensure that wp_validate_redirect() sanitizes a wider variety of characters.
  • Themes: Ensure a broken theme name is returned properly.
  • Administration: Add a new filter to extend set-screen-option.

Merges [47948-47951] to the 5.2 branch.
Props xknown, sstoqnov, vortfu, SergeyBiryukov, whyisjake.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.2/tests/phpunit/tests/oembed/filterResult.php

    r42343 r47960  
    103103                $this->assertEquals( '<blockquote class="wp-embedded-content"></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"></iframe>', $actual );
    104104        }
     105
     106        public function _data_oembed_test_strings() {
     107                return array(
     108                        array(
     109                                '<blockquote></blockquote><iframe title=""></iframe>',
     110                                '<blockquote class="wp-embedded-content"></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="position: absolute; clip: rect(1px, 1px, 1px, 1px);" title="Hola"></iframe>',
     111                        ),
     112                        array(
     113                                '<blockquote class="foo" id="bar"><strong><a href="" target=""></a></strong></blockquote><iframe width=123></iframe>',
     114                                '<blockquote class="wp-embedded-content"><a href=""></a></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="position: absolute; clip: rect(1px, 1px, 1px, 1px);" title="Hola" width="123"></iframe>',
     115                        ),
     116                        array(
     117                                '<blockquote><iframe width="100"></iframe></blockquote><iframe stitle="aaaa"></iframe>',
     118                                '<blockquote class="wp-embedded-content"><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="position: absolute; clip: rect(1px, 1px, 1px, 1px);" title="Hola" width="100"></iframe></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="position: absolute; clip: rect(1px, 1px, 1px, 1px);" title="Hola"></iframe>',
     119                        ),
     120                        array(
     121                                "<blockquote><iframe title=' width=\"'></iframe></blockquote><iframe title='' height=' title=' width=\"'' heigt='123'\"></iframe>",
     122                                '<blockquote class="wp-embedded-content"><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="position: absolute; clip: rect(1px, 1px, 1px, 1px);" title=" width=&quot;"></iframe></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="position: absolute; clip: rect(1px, 1px, 1px, 1px);" title=" width=&quot;" height=\' title=\' width="\'\' heigt=\'123\'"></iframe>',
     123                        ),
     124                );
     125        }
     126
     127        /**
     128         * @dataProvider _data_oembed_test_strings
     129         */
     130        public function test_wp_filter_pre_oembed_custom_result( $html, $expected ) {
     131                $data   = (object) [
     132                        'type'  => 'rich',
     133                        'title' => 'Hola',
     134                        'html'  => $html,
     135                ];
     136                $actual = _wp_oembed_get_object()->data2html( $data, 'https://untrusted.localhost' );
     137                $this->assertEquals( $expected, $actual );
     138        }
    105139}
Note: See TracChangeset for help on using the changeset viewer.