Make WordPress Core


Ignore:
Timestamp:
06/23/2020 05:05:57 AM (6 years ago)
Author:
whyisjake
Message:

Formatting: Extend wp_kses_hair and wp_kses_hair_parse to allow digits and underscores.

Fixes a lot of issues around parsing XML/HTML attributes.

Fixes #49464.

See #34406, #48608.

Props codeforest, zodiac1978, johnpgreen, dlh, ayeshrajans, johnpgreen, rilwis, travisnorthcutt, miqrogroove, chriscct7, whyisjake.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/kses.php

    r48086 r48132  
    630630                                false,
    631631                        ),
     632                        // using digit in attribute name should work
     633                        array(
     634                                'href="https://example.com/[shortcode attr=\'value\']" data-op3-timer-seconds="0"',
     635                                array( 'href="https://example.com/[shortcode attr=\'value\']" ', 'data-op3-timer-seconds="0"' ),
     636                        ),
     637                        // using underscore in attribute name should work
     638                        array(
     639                                'href="https://example.com/[shortcode attr=\'value\']" data-op_timer-seconds="0"',
     640                                array( 'href="https://example.com/[shortcode attr=\'value\']" ', 'data-op_timer-seconds="0"' ),
     641                        ),
     642                        // using period in attribute name should work
     643                        array(
     644                                'href="https://example.com/[shortcode attr=\'value\']" data-op.timer-seconds="0"',
     645                                array( 'href="https://example.com/[shortcode attr=\'value\']" ', 'data-op.timer-seconds="0"' ),
     646                        ),
     647                        // using digit at a beginning of attribute name should return false
     648                        array(
     649                                'href="https://example.com/[shortcode attr=\'value\']" 3data-op-timer-seconds="0"',
     650                                false,
     651                        ),
    632652                );
    633653        }
Note: See TracChangeset for help on using the changeset viewer.