WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/12/2015 12:02:31 AM (5 years ago)
Author:
pento
Message:

In get_avatar(), revert the <img> tag attributes to using single quotes, instead of double quotes. This behaviour was changed in [31107], but caused problems for code that attempted to parse the <img> tag.

See #21195

File:
1 edited

Legend:

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

    r31107 r31152  
    167167    public function test_get_avatar() {
    168168        $img = get_avatar( 1 );
    169         $this->assertEquals( preg_match( '|^<img alt="[^"]*" src="[^"]*" class="[^"]*" height="[^"]*" width="[^"]*" />$|', $img ), 1 );
     169        $this->assertEquals( preg_match( "|^<img alt='[^']*' src='[^']*' class='[^']*' height='[^']*' width='[^']*' />$|", $img ), 1 );
    170170    }
    171171
     
    173173        $size = '100';
    174174        $img = get_avatar( 1, $size );
    175         $this->assertEquals( preg_match( '|^<img .*height="' . $size . '".*width="' . $size . '"|', $img ), 1 );
     175        $this->assertEquals( preg_match( "|^<img .*height='$size'.*width='$size'|", $img ), 1 );
    176176    }
    177177
     
    179179        $alt = 'Mr Hyde';
    180180        $img = get_avatar( 1, 96, '', $alt );
    181         $this->assertEquals( preg_match( '|^<img alt="' . $alt . '"|', $img ), 1 );
     181        $this->assertEquals( preg_match( "|^<img alt='$alt'|", $img ), 1 );
    182182    }
    183183
     
    185185        $class = 'first';
    186186        $img = get_avatar( 1, 96, '', '', array( 'class' => $class ) );
    187         $this->assertEquals( preg_match( '|^<img .*class="[^"]*' . $class . '[^"]*"|', $img ), 1 );
     187        $this->assertEquals( preg_match( "|^<img .*class='[^']*{$class}[^']*'|", $img ), 1 );
    188188    }
    189189
    190190    public function test_get_avatar_default_class() {
    191191        $img = get_avatar( 1, 96, '', '', array( 'force_default' => true ) );
    192         $this->assertEquals( preg_match( '|^<img .*class="[^"]*avatar-default[^"]*"|', $img ), 1 );
     192        $this->assertEquals( preg_match( "|^<img .*class='[^']*avatar-default[^']*'|", $img ), 1 );
    193193    }
    194194
Note: See TracChangeset for help on using the changeset viewer.