Changeset 4637 in subversion


Ignore:
Timestamp:
Apr 8, 2011 3:22:07 AM (2 years ago)
Author:
alec
Message:
  • Fix bug where some content would cause hang on html2text conversion (#1487863)
Location:
trunk/roundcubemail
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/CHANGELOG

    r4636 r4637  
    22=========================== 
    33 
     4- Fix bug where some content would cause hang on html2text conversion (#1487863) 
    45- Improve space-stuffing handling in format=flowed messages (#1487861) 
    5 - Fixed bug where some dates would produce SQL error in MySQL (#1487856) 
     6- Fix bug where some dates would produce SQL error in MySQL (#1487856) 
    67- Added workaround for some IMAP server with broken STATUS response (#1487859) 
    78- Fix bug where default_charset was not used for text messages (#1487836) 
  • trunk/roundcubemail/program/lib/html2text.php

    r4580 r4637  
    573573    function _convert_pre(&$text) 
    574574    { 
     575        // get the content of PRE element 
    575576        while (preg_match('/<pre[^>]*>(.*)<\/pre>/ismU', $text, $matches)) { 
    576             $result = preg_replace($this->pre_search, $this->pre_replace, $matches[1]); 
    577             $text = preg_replace('/<pre[^>]*>.*<\/pre>/ismU', '<div><br>' . $result . '<br></div>', $text, 1); 
     577            // convert the content 
     578            $this->pre_content = sprintf('<div><br>%s<br></div>', 
     579                preg_replace($this->pre_search, $this->pre_replace, $matches[1])); 
     580            // replace the content (use callback because content can contain $0 variable) 
     581            $text = preg_replace_callback('/<pre[^>]*>.*<\/pre>/ismU',  
     582                array('html2text', '_preg_pre_callback'), $text, 1); 
     583            // free memory 
     584            $this->pre_content = ''; 
    578585        } 
    579586    } 
     
    640647     *  @param  array PREG matches 
    641648     *  @return string 
    642      *  @access private 
    643      */ 
    644     function _preg_callback($matches) 
     649     */ 
     650    private function _preg_callback($matches) 
    645651    { 
    646652        switch($matches[1]) { 
     
    660666 
    661667    /** 
     668     *  Callback function for preg_replace_callback use in PRE content handler. 
     669     * 
     670     *  @param  array PREG matches 
     671     *  @return string 
     672     */ 
     673    private function _preg_pre_callback($matches) 
     674    { 
     675        return $this->pre_content; 
     676    } 
     677 
     678    /** 
    662679     *  Strtoupper multibyte wrapper function 
    663680     * 
    664681     *  @param  string 
    665682     *  @return string 
    666      *  @access private 
    667      */ 
    668     function _strtoupper($str) 
     683     */ 
     684    private function _strtoupper($str) 
    669685    { 
    670686        if (function_exists('mb_strtoupper')) 
Note: See TracChangeset for help on using the changeset viewer.