: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// Returns an array of 2 elements. The number of undeleted
// msgs in the mailbox, and the size of the mbox in octets.
$PopArray = $this->last("array");
if($PopArray == -1) { return false; }
if( (!$PopArray) or (empty($PopArray)) )
function uidl ($msgNum = "")
// Returns the UIDL of the msg specified. If called with
// no arguments, returns an associative array where each
// undeleted msg num is a key, and the msg's uidl is the element
// Array element 0 will contain the total number of msgs
$this->ERROR = "POP3 uidl: " . _("No connection to server");
$reply = $this->send_cmd($cmd);
if(!$this->is_ok($reply))
$this->ERROR = "POP3 uidl: " . _("Error ") . "[$reply]";
list ($ok,$num,$myUidl) = preg_split('/\s+/',$reply);
$reply = fgets($fp, $buffer);
$reply = $this->strip_clf($reply);
if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); }
if(!$this->is_ok($reply))
$this->ERROR = "POP3 uidl: " . _("Error ") . "[$reply]";
$line = fgets($fp,$buffer);
while ( !preg_match('/^\.\r\n/',$line)) {
list ($msg,$msgUidl) = preg_split('/\s+/',$line);
$msgUidl = $this->strip_clf($msgUidl);
$UIDLArray[$msg] = $msgUidl;
$UIDLArray[$count] = 'deleted';
$line = fgets($fp,$buffer);
function delete ($msgNum = "") {
// Flags a specified msg as deleted. The msg will not
// be deleted until a quit() method is called.
$this->ERROR = "POP3 delete: " . _("No connection to server");
$this->ERROR = "POP3 delete: " . _("No msg number submitted");
$reply = $this->send_cmd("DELE $msgNum");
if(!$this->is_ok($reply))
$this->ERROR = "POP3 delete: " . _("Command failed ") . "[$reply]";
// *********************************************************
// The following methods are internal to the class.
function is_ok ($cmd = "") {
// Return true or false on +OK or -ERR
return( stripos($cmd, '+OK') !== false );
function strip_clf ($text = "") {
// Strips \r\n from server responses
$stripped = str_replace(array("\r","\n"),'',$text);
function parse_banner ( $server_text ) {
$length = strlen($server_text);
for($count =0; $count < $length; $count++)
$digit = substr($server_text,$count,1);
if( (!$outside) && ($digit != '<') && ($digit != '>') )
$banner = $this->strip_clf($banner); // Just in case
// For php4 compatibility
if (!function_exists("stripos")) {
function stripos($haystack, $needle){
return strpos($haystack, stristr( $haystack, $needle ));