Ticket #10831: 10831.diff
File 10831.diff, 2.2 KB (added by , 15 years ago) |
---|
-
wp-admin/includes/class-ftp-sockets.php
25 25 * @link http://www.phpclasses.org/browse/package/1743.html Site 26 26 * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html 27 27 */ 28 29 /** 30 * Patched by darkman82<at>interfree.it 31 * against http://wordpress.org/support/topic/288093 issue 32 * 33 */ 28 34 class ftp extends ftp_base { 29 35 30 36 function ftp($verb=FALSE, $le=FALSE) { … … 70 76 return $sock; 71 77 } 72 78 79 //patched by darkman82<at>interfree.it 73 80 function _readmsg($fnction="_readmsg"){ 74 81 if(!$this->_connected) { 75 82 $this->PushError($fnction,'Connect first'); … … 78 85 $result=true; 79 86 $this->_message=""; 80 87 $this->_code=0; 81 $go=true;82 do{88 // Read until at least ONE line is available 89 while ( ($pos = strpos($this->_buffz, CRLF))===false ) { 83 90 $tmp=@socket_read($this->_ftp_control_sock, 4096, PHP_BINARY_READ); 84 if($tmp===false) { 85 $go=$result=false; 91 if($tmp===false){ 86 92 $this->PushError($fnction,'Read failed', socket_strerror(socket_last_error($this->_ftp_control_sock))); 87 } else { 88 $this->_message.=$tmp; 89 $go = !preg_match("/^([0-9]{3})(-.+\\1)? [^".CRLF."]+".CRLF."$/Us", $this->_message, $regs); 93 return false; 90 94 } 91 } while($go); 95 $this->_buffz.=$tmp; 96 } 97 $this->_message = substr($this->_buffz,0,$pos).CRLF; 98 $this->_buffz = substr($this->_buffz,$pos+strlen(CRLF)); 99 if( !preg_match("/^([0-9]{3})(-.+\\1)? .+$/Us",$this->_message, $regs)) 100 return ($this->_readmsg($fnction)); 92 101 if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; 93 102 $this->_code=(int)$regs[1]; 94 103 return $result; … … 100 109 return FALSE; 101 110 } 102 111 if($this->LocalEcho) echo "PUT > ",$cmd,CRLF; 112 $this->_buffz=""; 103 113 $status=@socket_write($this->_ftp_control_sock, $cmd.CRLF); 104 114 if($status===false) { 105 115 $this->PushError($fnction,'socket write failed', socket_strerror(socket_last_error($this->stream))); … … 247 257 } 248 258 } 249 259 } 250 ?> 260 ?> 261 No newline at end of file