WordPress.org

Make WordPress Core

Changeset 34281


Ignore:
Timestamp:
09/18/2015 08:19:18 AM (4 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

Location:
trunk/src/wp-admin/includes
Files:
3 edited

Legend:

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

    r32990 r34281  
    111111                return FALSE;
    112112            }
    113             $ip_port = explode(",", ereg_replace("^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*".CRLF."$", "\\1", $this->_message));
     113            $ip_port = explode(",", preg_replace("/^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*$/s", "\\1", $this->_message));
    114114            $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3];
    115115            $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]);
  • trunk/src/wp-admin/includes/class-ftp-sockets.php

    r32990 r34281  
    132132                return FALSE;
    133133            }
    134             $ip_port = explode(",", ereg_replace("^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*".CRLF."$", "\\1", $this->_message));
     134            $ip_port = explode(",", preg_replace("/^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*$/s", "\\1", $this->_message));
    135135            $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3];
    136             $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]);
     136            $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]);
    137137            $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
    138138            if(!@socket_connect($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) {
  • 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.