WordPress.org

Make WordPress Core

Changeset 39567


Ignore:
Timestamp:
12/12/2016 01:44:26 AM (18 months ago)
Author:
dd32
Message:

Customize: Prevent single quotes (apostrophes) in custom_css values from unexpectedly causing false positives for unbalanced character validation errors.

Props westonruter.
See #39218, #35395.
Merges [39559] to the 4.7 branch.
Fixes #39198.

Location:
branches/4.7
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

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

    r39350 r39567  
    192192        }
    193193
    194         // Ensure single quotes are equal.
    195         if ( ! $this->validate_equal_characters( '\'', $css ) ) {
    196             $validity->add( 'unequal_single_quotes', __( 'Your single quotes <code>\'</code> are uneven. Make sure there is a closing <code>\'</code> for every opening <code>\'</code>.' ) );
    197             $imbalanced = true;
    198         }
    199 
    200         // Ensure single quotes are equal.
     194        // Ensure double quotes are equal.
    201195        if ( ! $this->validate_equal_characters( '"', $css ) ) {
    202196            $validity->add( 'unequal_double_quotes', __( 'Your double quotes <code>"</code> are uneven. Make sure there is a closing <code>"</code> for every opening <code>"</code>.' ) );
  • branches/4.7/tests/phpunit/tests/customize/custom-css-setting.php

    r39479 r39567  
    365365        $this->assertTrue( array_key_exists( 'unequal_double_quotes', $result->errors ) );
    366366
    367         // Check for Imbalanced Single Quotes.
    368         $imbalanced_single_quotes = $basic_css . " div.background-image { background-image: url( 'image.jpg ); } ";
    369         $result = $this->setting->validate( $imbalanced_single_quotes );
    370         $this->assertTrue( array_key_exists( 'unequal_single_quotes', $result->errors ) );
    371 
    372367        // Check for Unclosed Parentheses.
    373368        $unclosed_parentheses = $basic_css . ' div.background-image { background-image: url( "image.jpg" ; } ';
Note: See TracChangeset for help on using the changeset viewer.