Ticket #4337: class-pop3.php.patch

File class-pop3.php.patch, 896 bytes (added by cfactor, 6 years ago)

This version adds to the trailing period function to strip all leading periods added by the POP3 server.

  • wp-includes/class-pop3.php

    old new  
    367367        while ( !ereg("^\.\r\n",$line)) 
    368368        { 
    369369            $line = fgets($fp,$buffer); 
    370             if (preg_match("/^\s+/", $line) && $count > 0) { 
     370            if (preg_match("/^\s+\S+/", $line) && $count > 0) { 
    371371                $MsgArray[$count-1] .= $line; 
    372372                continue; 
    373373            } 
    374             if(empty($line))    { break; } 
     374            if ((ereg("^\.\r\n",$line)) || (empty($line)))    { break; } 
     375 
     376            //Strip any extra leading periods and store the result 
     377            if (ereg("^\.\.", $line)) { 
     378                    $MsgArray[$count] = substr($line, 1); 
     379            } else { 
     380                    $MsgArray[$count]  = $line; 
     381            } 
    375382 
    376             $MsgArray[$count] = $line; 
    377383            $count++; 
    378384        } 
    379385        return $MsgArray;