WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/18/2015 08:19:18 AM (6 years ago)
Author:
dd32
Message:

Updates: FTP/PemFTP Library: Remove the usage of deprecated regular expression functions (ereg replaced by PCRE).

Props enshrined, aaroncampbell
Fixes #16026, #33432

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-ftp.php

    r32990 r34281  
    381381        if(!$this->_exec("PWD", "pwd")) return FALSE;
    382382        if(!$this->_checkCode()) return FALSE;
    383         return ereg_replace("^[0-9]{3} \"(.+)\".+", "\\1", $this->_message);
     383        return preg_replace("/^[0-9]{3} \"(.+)\".*$/s", "\\1", $this->_message);
    384384    }
    385385
     
    425425        if(!$this->_exec("SIZE ".$pathname, "filesize")) return FALSE;
    426426        if(!$this->_checkCode()) return FALSE;
    427         return ereg_replace("^[0-9]{3} ([0-9]+)".CRLF, "\\1", $this->_message);
     427        return preg_replace("/^[0-9]{3} ([0-9]+).*$/s", "\\1", $this->_message);
    428428    }
    429429
     
    445445        if(!$this->_exec("MDTM ".$pathname, "mdtm")) return FALSE;
    446446        if(!$this->_checkCode()) return FALSE;
    447         $mdtm = ereg_replace("^[0-9]{3} ([0-9]+)".CRLF, "\\1", $this->_message);
     447        $mdtm = preg_replace("/^[0-9]{3} ([0-9]+).*$/", "\\1", $this->_message);
    448448        $date = sscanf($mdtm, "%4d%2d%2d%2d%2d%2d");
    449449        $timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]);
     
    819819        $sensitive=(PHP_OS!='WIN32');
    820820        return ($sensitive?
    821             ereg($pattern,$probe):
    822             eregi($pattern,$probe)
     821            preg_match( '/' . preg_quote( $pattern, '/' ) . '/', $probe ) :
     822            preg_match( '/' . preg_quote( $pattern, '/' ) . '/i', $probe )
    823823        );
    824824    }
Note: See TracChangeset for help on using the changeset viewer.