Changeset 4667 in subversion


Ignore:
Timestamp:
Apr 19, 2011 4:23:31 AM (2 years ago)
Author:
alec
Message:
  • Fix regression in html conditional comments handling by washtml class
Location:
trunk/roundcubemail
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/lib/washtml.php

    r4517 r4667  
    274274 
    275275    // Remove invalid HTML comments (#1487759) 
    276     $html = preg_replace('/<!--[^->]*>/', '', $html); 
     276    // Don't remove valid conditional comments 
     277    $html = preg_replace('/<!--[^->[]*>/', '', $html); 
    277278 
    278279    @$node->loadHTML($html); 
  • trunk/roundcubemail/tests/mailfunc.php

    r4489 r4667  
    122122  { 
    123123    $part = $this->get_html_part('src/mailto.txt'); 
    124      
     124 
    125125    // render HTML in normal mode 
    126126    $html = rcmail_html4inline(rcmail_print_body($part, array('safe' => false)), 'foo'); 
     
    132132  } 
    133133 
     134  /** 
     135   * Test the elimination of HTML comments 
     136   */ 
     137  function test_html_comments() 
     138  { 
     139    $part = $this->get_html_part('src/htmlcom.txt'); 
     140    $washed = rcmail_print_body($part, array('safe' => true)); 
     141 
     142    // #1487759 
     143    $this->assertPattern('|<p>test1</p>|', $washed, "Buggy HTML comments"); 
     144    // but conditional comments (<!--[if ...) should be removed 
     145    $this->assertNoPattern('|<p>test2</p>|', $washed, "Conditional HTML comments"); 
     146  } 
     147 
    134148} 
Note: See TracChangeset for help on using the changeset viewer.