mirror of
https://github.com/moodle/moodle.git
synced 2025-03-24 09:30:17 +01:00
MDL-76089 lib: upgrade horde library
This commit is contained in:
parent
cb6dc699b8
commit
d9d9d42c81
@ -26,7 +26,12 @@ class Horde_Crypt_Blowfish_Openssl extends Horde_Crypt_Blowfish_Base
|
||||
*/
|
||||
public static function supported()
|
||||
{
|
||||
return extension_loaded('openssl');
|
||||
if (extension_loaded('openssl')) {
|
||||
$ciphers = openssl_get_cipher_methods();
|
||||
return in_array('bf-ecb', $ciphers) && in_array('bf-cbc', $ciphers);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -265,6 +265,7 @@ class Horde_Domhtml implements Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
if ($this->_iterator instanceof DOMDocument) {
|
||||
@ -277,6 +278,7 @@ class Horde_Domhtml implements Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return 0;
|
||||
@ -284,6 +286,7 @@ class Horde_Domhtml implements Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function next()
|
||||
{
|
||||
/* Iterate in the reverse direction through the node list. This allows
|
||||
@ -321,6 +324,7 @@ class Horde_Domhtml implements Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
{
|
||||
$this->_iterator = $this->dom;
|
||||
@ -328,6 +332,7 @@ class Horde_Domhtml implements Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function valid()
|
||||
{
|
||||
return !is_null($this->_iterator);
|
||||
|
@ -48,7 +48,7 @@ class Horde_Exception_LastError extends Horde_Exception
|
||||
$this->file = $code_or_lasterror['file'];
|
||||
$this->line = $code_or_lasterror['line'];
|
||||
} else {
|
||||
parent::__construct($message, $code_or_lasterror);
|
||||
parent::__construct($message, $code_or_lasterror ?? 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ class Horde_Exception_PermissionDenied extends Horde_Exception
|
||||
*
|
||||
* @see Horde_Exception::__construct()
|
||||
*
|
||||
* @param mixed $message The exception message, a PEAR_Error
|
||||
* @param string|Exception $message The exception message, a PEAR_Error
|
||||
* object, or an Exception object.
|
||||
* @param integer $code A numeric error code.
|
||||
*/
|
||||
|
@ -36,9 +36,15 @@ class Horde_Idna
|
||||
{
|
||||
switch ($backend = static::_getBackend()) {
|
||||
case 'INTL':
|
||||
if ($data === null) {
|
||||
return false;
|
||||
}
|
||||
return idn_to_ascii($data);
|
||||
|
||||
case 'INTL_UTS46':
|
||||
if ($data === null) {
|
||||
return false;
|
||||
}
|
||||
$result = idn_to_ascii($data, 0, INTL_IDNA_VARIANT_UTS46, $info);
|
||||
self::_checkForError($info);
|
||||
return $result;
|
||||
|
@ -232,7 +232,7 @@ implements Serializable, SplObserver
|
||||
* DEFAULT: 30 seconds
|
||||
* - username: (string) [REQUIRED] The username.
|
||||
* - authusername (string) The username used for SASL authentication.
|
||||
* If specified this is the user name whose password is used
|
||||
* If specified this is the user name whose password is used
|
||||
* (e.g. administrator).
|
||||
* Only valid for RFC 2595/4616 - PLAIN SASL mechanism.
|
||||
* DEFAULT: the same value provided in the username parameter.
|
||||
@ -346,6 +346,7 @@ implements Serializable, SplObserver
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function update(SplSubject $subject)
|
||||
{
|
||||
if (($subject instanceof Horde_Imap_Client_Data_Capability) ||
|
||||
@ -363,11 +364,7 @@ implements Serializable, SplObserver
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return serialize(array(
|
||||
'i' => $this->_init,
|
||||
'p' => $this->_params,
|
||||
'v' => self::VERSION
|
||||
));
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -375,9 +372,27 @@ implements Serializable, SplObserver
|
||||
public function unserialize($data)
|
||||
{
|
||||
$data = @unserialize($data);
|
||||
if (!is_array($data) ||
|
||||
!isset($data['v']) ||
|
||||
($data['v'] != self::VERSION)) {
|
||||
if (!is_array($data)) {
|
||||
throw new Exception('Cache version change');
|
||||
}
|
||||
$this->__unserialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
return array(
|
||||
'i' => $this->_init,
|
||||
'p' => $this->_params,
|
||||
'v' => self::VERSION
|
||||
);
|
||||
}
|
||||
|
||||
public function __unserialize(array $data)
|
||||
{
|
||||
if (empty($data['v']) || $data['v'] != self::VERSION) {
|
||||
throw new Exception('Cache version change');
|
||||
}
|
||||
|
||||
@ -3993,9 +4008,8 @@ implements Serializable, SplObserver
|
||||
$vanished = $this->vanished($this->_selected, $modseq, array(
|
||||
'ids' => $uids_ob
|
||||
));
|
||||
$disappear = array_diff($uids_ob->ids, $vanished->ids);
|
||||
if (!empty($disappear)) {
|
||||
$this->_deleteMsgs($this->_selected, $this->getIdsOb($disappear));
|
||||
if (!empty($vanished->ids)) {
|
||||
$this->_deleteMsgs($this->_selected, $this->getIdsOb($vanished->ids));
|
||||
}
|
||||
|
||||
$mbox_ob->sync = true;
|
||||
|
@ -73,6 +73,7 @@ implements SplSubject
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function attach(SplObserver $observer)
|
||||
{
|
||||
$this->detach($observer);
|
||||
@ -81,6 +82,7 @@ implements SplSubject
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function detach(SplObserver $observer)
|
||||
{
|
||||
if (($key = array_search($observer, $this->_observers, true)) !== false) {
|
||||
@ -92,6 +94,7 @@ implements SplSubject
|
||||
* Notification is triggered internally whenever the object's internal
|
||||
* data storage is altered.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function notify()
|
||||
{
|
||||
foreach ($this->_observers as $val) {
|
||||
|
@ -151,15 +151,27 @@ abstract class Horde_Imap_Client_Cache_Backend implements Serializable
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return serialize($this->_params);
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function unserialize($data)
|
||||
{
|
||||
$this->_params = unserialize($data);
|
||||
$this->_initOb();
|
||||
$this->__unserialize(unserialize($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
return $this->_params;
|
||||
}
|
||||
|
||||
public function __unserialize(array $data)
|
||||
{
|
||||
$this->_params = $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -498,9 +498,17 @@ extends Horde_Imap_Client_Cache_Backend
|
||||
/**
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return $this->__serialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
$this->save();
|
||||
return parent::serialize();
|
||||
return parent::__serialize();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -100,6 +100,7 @@ class Horde_Imap_Client_Data_Acl extends Horde_Imap_Client_Data_AclCommon implem
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return $this[$offset];
|
||||
@ -107,6 +108,7 @@ class Horde_Imap_Client_Data_Acl extends Horde_Imap_Client_Data_AclCommon implem
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return in_array($offset, $this->_rights);
|
||||
@ -114,6 +116,7 @@ class Horde_Imap_Client_Data_Acl extends Horde_Imap_Client_Data_AclCommon implem
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
if ($value) {
|
||||
@ -133,6 +136,7 @@ class Horde_Imap_Client_Data_Acl extends Horde_Imap_Client_Data_AclCommon implem
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
$this->_rights = array_values(array_diff($this->_rights, array($offset)));
|
||||
@ -140,6 +144,7 @@ class Horde_Imap_Client_Data_Acl extends Horde_Imap_Client_Data_AclCommon implem
|
||||
|
||||
/* IteratorAggregate method. */
|
||||
|
||||
#[ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->_rights);
|
||||
@ -151,14 +156,33 @@ class Horde_Imap_Client_Data_Acl extends Horde_Imap_Client_Data_AclCommon implem
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return json_encode($this->_rights);
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function unserialize($data)
|
||||
{
|
||||
$this->_rights = json_decode($data);
|
||||
$data = @unserialize($data);
|
||||
if (!is_array($data)) {
|
||||
throw new Exception('Cache version changed.');
|
||||
}
|
||||
$this->__unserialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
return array(
|
||||
'rights' => $this->_rights
|
||||
);
|
||||
}
|
||||
|
||||
public function __unserialize(array $data)
|
||||
{
|
||||
$this->_rights = $data['rights'];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -94,6 +94,7 @@ class Horde_Imap_Client_Data_AclRights extends Horde_Imap_Client_Data_AclCommon
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return (bool)$this[$offset];
|
||||
@ -101,6 +102,7 @@ class Horde_Imap_Client_Data_AclRights extends Horde_Imap_Client_Data_AclCommon
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
if (isset($this->_optional[$offset])) {
|
||||
@ -116,6 +118,7 @@ class Horde_Imap_Client_Data_AclRights extends Horde_Imap_Client_Data_AclCommon
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->_optional[$offset] = $value;
|
||||
@ -124,6 +127,7 @@ class Horde_Imap_Client_Data_AclRights extends Horde_Imap_Client_Data_AclCommon
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->_optional[$offset]);
|
||||
@ -140,6 +144,7 @@ class Horde_Imap_Client_Data_AclRights extends Horde_Imap_Client_Data_AclCommon
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
$val = current($this->_required);
|
||||
@ -150,6 +155,7 @@ class Horde_Imap_Client_Data_AclRights extends Horde_Imap_Client_Data_AclCommon
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
$key = key($this->_required);
|
||||
@ -160,6 +166,7 @@ class Horde_Imap_Client_Data_AclRights extends Horde_Imap_Client_Data_AclCommon
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function next()
|
||||
{
|
||||
if (key($this->_required) === null) {
|
||||
@ -171,6 +178,7 @@ class Horde_Imap_Client_Data_AclRights extends Horde_Imap_Client_Data_AclCommon
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
{
|
||||
reset($this->_required);
|
||||
@ -179,6 +187,7 @@ class Horde_Imap_Client_Data_AclRights extends Horde_Imap_Client_Data_AclCommon
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function valid()
|
||||
{
|
||||
return ((key($this->_required) !== null) ||
|
||||
@ -192,17 +201,31 @@ class Horde_Imap_Client_Data_AclRights extends Horde_Imap_Client_Data_AclCommon
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return json_encode(array(
|
||||
$this->_required,
|
||||
$this->_optional
|
||||
));
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function unserialize($data)
|
||||
{
|
||||
list($this->_required, $this->_optional) = json_decode($data);
|
||||
$data = @unserialize($data);
|
||||
if (!is_array($data)) {
|
||||
throw new Exception('Cache version changed.');
|
||||
}
|
||||
$this->__unserialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
return [$this->_required, $this->_optional];
|
||||
}
|
||||
|
||||
public function __unserialize(array $data)
|
||||
{
|
||||
list($this->_required, $this->_optional) = $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -169,6 +169,7 @@ implements Serializable, SplSubject
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function attach(SplObserver $observer)
|
||||
{
|
||||
$this->detach($observer);
|
||||
@ -177,6 +178,7 @@ implements Serializable, SplSubject
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function detach(SplObserver $observer)
|
||||
{
|
||||
if (($key = array_search($observer, $this->_observers, true)) !== false) {
|
||||
@ -188,6 +190,7 @@ implements Serializable, SplSubject
|
||||
* Notification is triggered internally whenever the object's internal
|
||||
* data storage is altered.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function notify()
|
||||
{
|
||||
foreach ($this->_observers as $val) {
|
||||
@ -201,14 +204,31 @@ implements Serializable, SplSubject
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return json_encode($this->_data);
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function unserialize($data)
|
||||
{
|
||||
$this->_data = json_decode($data, true);
|
||||
$data = @unserialize($data);
|
||||
if (!is_array($data)) {
|
||||
throw new Exception('Cache version change.');
|
||||
}
|
||||
$this->__unserialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
return $this->_data;
|
||||
}
|
||||
|
||||
public function __unserialize(array $data)
|
||||
{
|
||||
$this->_data = $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -205,18 +205,30 @@ class Horde_Imap_Client_Data_Envelope implements Serializable
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return serialize(array(
|
||||
'd' => $this->_data,
|
||||
'v' => self::VERSION
|
||||
));
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function unserialize($data)
|
||||
{
|
||||
$data = @unserialize($data);
|
||||
if (empty($data['v']) || ($data['v'] != self::VERSION)) {
|
||||
$this->__unserialize(@unserialize($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
return array(
|
||||
'd' => $this->_data,
|
||||
'v' => self::VERSION,
|
||||
);
|
||||
}
|
||||
|
||||
public function __unserialize(array $data)
|
||||
{
|
||||
if (empty($data['v']) || $data['v'] != self::VERSION) {
|
||||
throw new Exception('Cache version change');
|
||||
}
|
||||
|
||||
|
@ -618,14 +618,14 @@ class Horde_Imap_Client_Data_Fetch
|
||||
|
||||
case Horde_Imap_Client::FETCH_HEADERTEXT:
|
||||
case Horde_Imap_Client::FETCH_MIMEHEADER:
|
||||
$hdrs = $this->_data[$key][$id];
|
||||
break;
|
||||
return Horde_Mime_Headers::parseHeaders($this->_data[$key][$id]);
|
||||
}
|
||||
} else {
|
||||
$hdrs = $this->_getHeaders($id, self::HEADER_STREAM, $key);
|
||||
$parsed = Horde_Mime_Headers::parseHeaders($hdrs);
|
||||
fclose($hdrs);
|
||||
return $parsed;
|
||||
}
|
||||
|
||||
return Horde_Mime_Headers::parseHeaders($hdrs);
|
||||
}
|
||||
|
||||
if (!isset($this->_data[$key][$id])) {
|
||||
|
@ -31,6 +31,7 @@ class Horde_Imap_Client_Data_Format_Filter_Quote extends php_user_filter
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function onCreate()
|
||||
{
|
||||
$this->_prepend = false;
|
||||
@ -39,6 +40,7 @@ class Horde_Imap_Client_Data_Format_Filter_Quote extends php_user_filter
|
||||
/**
|
||||
* @see stream_filter_register()
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function filter($in, $out, &$consumed, $closing)
|
||||
{
|
||||
if (!$this->_prepend) {
|
||||
|
@ -33,6 +33,7 @@ class Horde_Imap_Client_Data_Format_Filter_String extends php_user_filter
|
||||
/**
|
||||
* @see stream_filter_register()
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function onCreate()
|
||||
{
|
||||
$this->params->binary = false;
|
||||
@ -47,6 +48,7 @@ class Horde_Imap_Client_Data_Format_Filter_String extends php_user_filter
|
||||
/**
|
||||
* @see stream_filter_register()
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function filter($in, $out, &$consumed, $closing)
|
||||
{
|
||||
$p = $this->params;
|
||||
|
@ -88,6 +88,7 @@ class Horde_Imap_Client_Data_Format_List extends Horde_Imap_Client_Data_Format i
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->_data);
|
||||
@ -98,6 +99,7 @@ class Horde_Imap_Client_Data_Format_List extends Horde_Imap_Client_Data_Format i
|
||||
/**
|
||||
* Iterator loops through the data elements contained in this list.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->_data);
|
||||
|
@ -130,14 +130,31 @@ class Horde_Imap_Client_Data_Namespace implements Serializable
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return json_encode($this->_data);
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function unserialize($data)
|
||||
{
|
||||
$this->_data = json_decode($data, true);
|
||||
$data = @unserialize($data);
|
||||
if (!is_array($data)) {
|
||||
throw new Exception('Cache version change.');
|
||||
}
|
||||
$this->__unserialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
return $this->_data;
|
||||
}
|
||||
|
||||
public function __unserialize(array $data)
|
||||
{
|
||||
$this->_data = $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -133,6 +133,7 @@ implements Serializable, SplSubject
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function attach(SplObserver $observer)
|
||||
{
|
||||
$this->detach($observer);
|
||||
@ -141,6 +142,7 @@ implements Serializable, SplSubject
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function detach(SplObserver $observer)
|
||||
{
|
||||
if (($key = array_search($observer, $this->_observers, true)) !== false) {
|
||||
@ -152,6 +154,7 @@ implements Serializable, SplSubject
|
||||
* Notification is triggered internally whenever the object's internal
|
||||
* data storage is altered.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function notify()
|
||||
{
|
||||
foreach ($this->_observers as $val) {
|
||||
@ -165,14 +168,31 @@ implements Serializable, SplSubject
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return json_encode($this->_charsets);
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function unserialize($data)
|
||||
{
|
||||
$this->_charsets = json_decode($data, true);
|
||||
$data = @unserialize($data);
|
||||
if (!is_array($data)) {
|
||||
throw new Exception('Cache version change');
|
||||
}
|
||||
$this->__unserialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
return $this->_charsets;
|
||||
}
|
||||
|
||||
public function __unserialize(array $data)
|
||||
{
|
||||
$this->_charsets = $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -63,4 +63,16 @@ extends Horde_Imap_Client_Data_SearchCharset
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function __unserialize(array $data)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -171,6 +171,7 @@ class Horde_Imap_Client_Data_Thread implements Countable, Serializable
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->_getAllIndices());
|
||||
@ -182,17 +183,31 @@ class Horde_Imap_Client_Data_Thread implements Countable, Serializable
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return json_encode(array(
|
||||
$this->_thread,
|
||||
$this->_type
|
||||
));
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function unserialize($data)
|
||||
{
|
||||
list($this->_thread, $this->_type) = json_decode($data, true);
|
||||
$data = @unserialize($data);
|
||||
if (!is_array($data)) {
|
||||
throw new Exception('Cache version changed.');
|
||||
}
|
||||
$this->__unserialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
return [$this->_thread, $this->_type];
|
||||
}
|
||||
|
||||
public function __unserialize(array $data)
|
||||
{
|
||||
list($this->_thread, $this->_type) = $data;
|
||||
}
|
||||
|
||||
/* Protected methods. */
|
||||
|
@ -35,7 +35,7 @@ class Horde_Imap_Client_DateTime extends DateTime
|
||||
|
||||
/* Bug #14381 Catch malformed offset - which doesn't cause
|
||||
DateTime to throw exception. */
|
||||
if (substr(rtrim($time), -5) === ' 0000') {
|
||||
if ($time !== null && substr(rtrim($time), -5) === ' 0000') {
|
||||
$time = substr(trim($time), 0, strlen(trim($time)) - 5) . ' +0000';
|
||||
try {
|
||||
if ($bug_67118) {
|
||||
@ -48,15 +48,15 @@ class Horde_Imap_Client_DateTime extends DateTime
|
||||
|
||||
try {
|
||||
if ($bug_67118) {
|
||||
new DateTime($time, $tz);
|
||||
new DateTime($time === null ? 'now' : $time, $tz);
|
||||
}
|
||||
parent::__construct($time, $tz);
|
||||
parent::__construct($time === null ? 'now' : $time, $tz);
|
||||
return;
|
||||
} catch (Exception $e) {}
|
||||
|
||||
/* Check for malformed day-of-week parts, usually incorrectly
|
||||
* localized. E.g. Fr, 15 Apr 2016 15:15:09 +0000 */
|
||||
if (!preg_match("/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun),/", $time)) {
|
||||
if ($time !== null && !preg_match("/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun),/", $time)) {
|
||||
$time = preg_replace("/^(\S*,)/", '', $time, 1, $i);
|
||||
if ($i) {
|
||||
try {
|
||||
@ -70,7 +70,7 @@ class Horde_Imap_Client_DateTime extends DateTime
|
||||
}
|
||||
|
||||
/* Bug #5717 - Check for UT vs. UTC. */
|
||||
if (substr(rtrim($time), -3) === ' UT') {
|
||||
if ($time !== null && substr(rtrim($time), -3) === ' UT') {
|
||||
try {
|
||||
if ($bug_67118) {
|
||||
new DateTime($time . 'C', $tz);
|
||||
|
@ -253,7 +253,7 @@ class Horde_Imap_Client_Exception extends Horde_Exception_Wrapped
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $message Error message (non-translated).
|
||||
* @param code $code Error code.
|
||||
* @param int $code Error code.
|
||||
*/
|
||||
public function __construct($message = null, $code = null)
|
||||
{
|
||||
|
@ -302,6 +302,7 @@ class Horde_Imap_Client_Fetch_Query implements ArrayAccess, Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->_data[$offset]);
|
||||
@ -309,6 +310,7 @@ class Horde_Imap_Client_Fetch_Query implements ArrayAccess, Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return isset($this->_data[$offset])
|
||||
@ -318,6 +320,7 @@ class Horde_Imap_Client_Fetch_Query implements ArrayAccess, Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->_data[$offset] = $value;
|
||||
@ -325,6 +328,7 @@ class Horde_Imap_Client_Fetch_Query implements ArrayAccess, Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->_data[$offset]);
|
||||
@ -334,6 +338,7 @@ class Horde_Imap_Client_Fetch_Query implements ArrayAccess, Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->_data);
|
||||
@ -343,6 +348,7 @@ class Horde_Imap_Client_Fetch_Query implements ArrayAccess, Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
$opts = current($this->_data);
|
||||
@ -354,6 +360,7 @@ class Horde_Imap_Client_Fetch_Query implements ArrayAccess, Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return key($this->_data);
|
||||
@ -361,6 +368,7 @@ class Horde_Imap_Client_Fetch_Query implements ArrayAccess, Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function next()
|
||||
{
|
||||
next($this->_data);
|
||||
@ -368,6 +376,7 @@ class Horde_Imap_Client_Fetch_Query implements ArrayAccess, Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
{
|
||||
reset($this->_data);
|
||||
@ -375,6 +384,7 @@ class Horde_Imap_Client_Fetch_Query implements ArrayAccess, Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function valid()
|
||||
{
|
||||
return !is_null($this->key());
|
||||
|
@ -132,6 +132,7 @@ implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->_data[$offset]);
|
||||
@ -139,6 +140,7 @@ implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return isset($this->_data[$offset])
|
||||
@ -148,6 +150,7 @@ implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->_data[$offset] = $value;
|
||||
@ -155,6 +158,7 @@ implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->_data[$offset]);
|
||||
@ -164,6 +168,7 @@ implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->_data);
|
||||
@ -173,6 +178,7 @@ implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
ksort($this->_data);
|
||||
|
@ -377,6 +377,7 @@ class Horde_Imap_Client_Ids implements Countable, Iterator, Serializable
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return is_array($this->_ids)
|
||||
@ -388,6 +389,7 @@ class Horde_Imap_Client_Ids implements Countable, Iterator, Serializable
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
return is_array($this->_ids)
|
||||
@ -397,6 +399,7 @@ class Horde_Imap_Client_Ids implements Countable, Iterator, Serializable
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return is_array($this->_ids)
|
||||
@ -406,6 +409,7 @@ class Horde_Imap_Client_Ids implements Countable, Iterator, Serializable
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function next()
|
||||
{
|
||||
if (is_array($this->_ids)) {
|
||||
@ -415,6 +419,7 @@ class Horde_Imap_Client_Ids implements Countable, Iterator, Serializable
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
{
|
||||
if (is_array($this->_ids)) {
|
||||
@ -424,16 +429,30 @@ class Horde_Imap_Client_Ids implements Countable, Iterator, Serializable
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function valid()
|
||||
{
|
||||
return !is_null($this->key());
|
||||
}
|
||||
|
||||
/* Serializable methods. */
|
||||
public function serialize()
|
||||
{
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
public function unserialize($data)
|
||||
{
|
||||
$data = @unserialize($data);
|
||||
if (!is_array($data)) {
|
||||
throw new Exception('Cache version change.');
|
||||
}
|
||||
|
||||
$this->__unserialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function serialize()
|
||||
public function __serialize()
|
||||
{
|
||||
$save = array();
|
||||
|
||||
@ -467,27 +486,25 @@ class Horde_Imap_Client_Ids implements Countable, Iterator, Serializable
|
||||
break;
|
||||
}
|
||||
|
||||
return serialize($save);
|
||||
return $save;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function unserialize($data)
|
||||
public function __unserialize($data)
|
||||
{
|
||||
$save = @unserialize($data);
|
||||
$this->duplicates = !empty($data['d']);
|
||||
$this->_sequence = !empty($data['s']);
|
||||
$this->_sorted = !empty($data['is']);
|
||||
|
||||
$this->duplicates = !empty($save['d']);
|
||||
$this->_sequence = !empty($save['s']);
|
||||
$this->_sorted = !empty($save['is']);
|
||||
|
||||
if (isset($save['a'])) {
|
||||
if (isset($data['a'])) {
|
||||
$this->_ids = self::ALL;
|
||||
} elseif (isset($save['l'])) {
|
||||
} elseif (isset($data['l'])) {
|
||||
$this->_ids = self::LARGEST;
|
||||
} elseif (isset($save['sr'])) {
|
||||
} elseif (isset($data['sr'])) {
|
||||
$this->_ids = self::SEARCH_RES;
|
||||
} elseif (isset($save['i'])) {
|
||||
$this->add($save['i']);
|
||||
} elseif (isset($data['i'])) {
|
||||
$this->add($data['i']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,6 +196,7 @@ class Horde_Imap_Client_Ids_Map implements Countable, IteratorAggregate, Seriali
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->_ids);
|
||||
@ -205,6 +206,7 @@ class Horde_Imap_Client_Ids_Map implements Countable, IteratorAggregate, Seriali
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->_ids);
|
||||
@ -212,25 +214,37 @@ class Horde_Imap_Client_Ids_Map implements Countable, IteratorAggregate, Seriali
|
||||
|
||||
/* Serializable methods. */
|
||||
|
||||
/**
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
/* Sort before storing; provides more compressible representation. */
|
||||
$this->sort();
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
return json_encode(array(
|
||||
strval(new Horde_Imap_Client_Ids(array_keys($this->_ids))),
|
||||
strval(new Horde_Imap_Client_Ids(array_values($this->_ids)))
|
||||
));
|
||||
public function unserialize($data)
|
||||
{
|
||||
$data = @unserialize($data);
|
||||
if (!is_array($data)) {
|
||||
throw new Exception('Cache version change.');
|
||||
}
|
||||
$this->__unserialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function unserialize($data)
|
||||
public function __serialize()
|
||||
{
|
||||
$data = json_decode($data, true);
|
||||
/* Sort before storing; provides more compressible representation. */
|
||||
$this->sort();
|
||||
|
||||
return [
|
||||
strval(new Horde_Imap_Client_Ids(array_keys($this->_ids))),
|
||||
strval(new Horde_Imap_Client_Ids(array_values($this->_ids)))
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function __unserialize($data)
|
||||
{
|
||||
$keys = new Horde_Imap_Client_Ids($data[0]);
|
||||
$vals = new Horde_Imap_Client_Ids($data[1]);
|
||||
$this->_ids = array_combine($keys->ids, $vals->ids);
|
||||
|
@ -143,6 +143,7 @@ class Horde_Imap_Client_Interaction_Pipeline implements Countable, IteratorAggre
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->_commands);
|
||||
@ -152,6 +153,7 @@ class Horde_Imap_Client_Interaction_Pipeline implements Countable, IteratorAggre
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->_commands);
|
||||
|
@ -134,14 +134,31 @@ class Horde_Imap_Client_Mailbox implements Serializable
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return json_encode(array($this->_utf7imap, $this->_utf8));
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function unserialize($data)
|
||||
{
|
||||
list($this->_utf7imap, $this->_utf8) = json_decode($data, true);
|
||||
$data = @unserialize($data);
|
||||
if (!is_array($data)) {
|
||||
throw new Exception('Cache value changed.');
|
||||
}
|
||||
$this->__unserialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
return [$this->_utf7imap, $this->_utf8];
|
||||
}
|
||||
|
||||
public function __unserialize(array $data)
|
||||
{
|
||||
list($this->_utf7imap, $this->_utf8) = $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -141,6 +141,7 @@ class Horde_Imap_Client_Mailbox_List implements Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->_mboxes);
|
||||
@ -150,6 +151,7 @@ class Horde_Imap_Client_Mailbox_List implements Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->_mboxes);
|
||||
|
@ -77,6 +77,7 @@ implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->_ns[strval($offset)]);
|
||||
@ -84,6 +85,7 @@ implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
$offset = strval($offset);
|
||||
@ -95,6 +97,7 @@ implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
if ($value instanceof Horde_Imap_Client_Data_Namespace) {
|
||||
@ -104,6 +107,7 @@ implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->_ns[strval($offset)]);
|
||||
@ -113,6 +117,7 @@ implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->_ns);
|
||||
@ -122,6 +127,7 @@ implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->_ns);
|
||||
|
@ -859,12 +859,27 @@ class Horde_Imap_Client_Search_Query implements Serializable
|
||||
|
||||
/* Serializable methods. */
|
||||
|
||||
public function serialize()
|
||||
{
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
public function unserialize($data)
|
||||
{
|
||||
$data = @unserialize($data);
|
||||
if (!is_array($data)) {
|
||||
throw new Exception('Cache version change.');
|
||||
}
|
||||
|
||||
$this->__unserialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialization.
|
||||
*
|
||||
* @return string Serialized data.
|
||||
*/
|
||||
public function serialize()
|
||||
public function __serialize()
|
||||
{
|
||||
$data = array(
|
||||
// Serialized data ID.
|
||||
@ -876,7 +891,7 @@ class Horde_Imap_Client_Search_Query implements Serializable
|
||||
$data[] = $this->_charset;
|
||||
}
|
||||
|
||||
return serialize($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -886,9 +901,8 @@ class Horde_Imap_Client_Search_Query implements Serializable
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function unserialize($data)
|
||||
public function __unserialize($data)
|
||||
{
|
||||
$data = @unserialize($data);
|
||||
if (!is_array($data) ||
|
||||
!isset($data[0]) ||
|
||||
($data[0] != self::VERSION)) {
|
||||
|
@ -2951,7 +2951,7 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base
|
||||
case Horde_Imap_Client::FETCH_BODYPART:
|
||||
case Horde_Imap_Client::FETCH_HEADERS:
|
||||
foreach ($c_val as $key => $val) {
|
||||
$cmd = ($key == 0)
|
||||
$cmd = ((int)$key == 0)
|
||||
? ''
|
||||
: $key . '.';
|
||||
$main_cmd = 'BODY';
|
||||
|
@ -220,6 +220,7 @@ class Horde_Imap_Client_Tokenize implements Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
return $this->_current;
|
||||
@ -227,6 +228,7 @@ class Horde_Imap_Client_Tokenize implements Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return $this->_key;
|
||||
@ -236,6 +238,7 @@ class Horde_Imap_Client_Tokenize implements Iterator
|
||||
* @return mixed Either a string, boolean (true for open paren, false for
|
||||
* close paren/EOS), Horde_Stream object, or null.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function next()
|
||||
{
|
||||
$level = isset($this->_nextModify['level'])
|
||||
@ -395,6 +398,7 @@ class Horde_Imap_Client_Tokenize implements Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
{
|
||||
$this->_stream->rewind();
|
||||
@ -405,6 +409,7 @@ class Horde_Imap_Client_Tokenize implements Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function valid()
|
||||
{
|
||||
return ($this->_level !== false);
|
||||
|
@ -289,14 +289,31 @@ class Horde_Imap_Client_Url implements Serializable
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return strval($this);
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function unserialize($data)
|
||||
{
|
||||
$this->_parse($data);
|
||||
$data = @unserialize($data);
|
||||
if (!is_array($data)) {
|
||||
throw new Exception('Cache version changed');
|
||||
}
|
||||
$this->__unserialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
return array((string)$this);
|
||||
}
|
||||
|
||||
public function __unserialize(array $data)
|
||||
{
|
||||
$this->_parse($data[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -160,14 +160,31 @@ abstract class Horde_Imap_Client_Url_Base implements Serializable
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return strval($this);
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function unserialize($data)
|
||||
{
|
||||
$this->_parse($data);
|
||||
$data = @unserialize($data);
|
||||
if (!is_array($data)) {
|
||||
throw new Exception('Cache version change.');
|
||||
}
|
||||
$this->__unserialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
return array((string)$this);
|
||||
}
|
||||
|
||||
public function __unserialize(array $data)
|
||||
{
|
||||
$this->_parse($data[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -133,6 +133,7 @@ implements ArrayAccess, Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->_parsed[$offset]);
|
||||
@ -140,6 +141,7 @@ implements ArrayAccess, Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
if (!isset($this->_parsed[$offset])) {
|
||||
@ -179,6 +181,7 @@ implements ArrayAccess, Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
// NOOP
|
||||
@ -186,6 +189,7 @@ implements ArrayAccess, Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
// NOOP
|
||||
@ -198,6 +202,7 @@ implements ArrayAccess, Countable, Iterator
|
||||
*
|
||||
* @return integer The number of messages.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->_parsed);
|
||||
@ -218,6 +223,7 @@ implements ArrayAccess, Countable, Iterator
|
||||
|
||||
/* Iterator methods. */
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
$key = $this->key();
|
||||
@ -227,11 +233,13 @@ implements ArrayAccess, Countable, Iterator
|
||||
: $this[$key];
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return key($this->_parsed);
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function next()
|
||||
{
|
||||
if ($this->valid()) {
|
||||
@ -239,11 +247,13 @@ implements ArrayAccess, Countable, Iterator
|
||||
}
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
{
|
||||
reset($this->_parsed);
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function valid()
|
||||
{
|
||||
return !is_null($this->key());
|
||||
|
@ -406,7 +406,7 @@ class Horde_Mail_Rfc822
|
||||
if ($this->_curr() == '@') {
|
||||
try {
|
||||
$this->_rfc822ParseDomain($host);
|
||||
if (strlen($host)) {
|
||||
if (!empty($host)) {
|
||||
$ob->host = $host;
|
||||
}
|
||||
} catch (Horde_Mail_Exception $e) {
|
||||
@ -647,7 +647,7 @@ class Horde_Mail_Rfc822
|
||||
/* TODO: Optimize by duplicating rfc822IsAtext code here */
|
||||
!$this->_rfc822IsAtext($chr, ',<:')) {
|
||||
$this->_rfc822SkipLwsp();
|
||||
if (!$this->_params['validate']) {
|
||||
if (!$this->_params['validate'] && $str !== null) {
|
||||
$str = trim($str);
|
||||
}
|
||||
return;
|
||||
|
@ -99,7 +99,7 @@ class Horde_Mail_Rfc822_Address extends Horde_Mail_Rfc822_Object
|
||||
break;
|
||||
|
||||
case 'personal':
|
||||
$this->_personal = strlen($value)
|
||||
$this->_personal = !empty($value)
|
||||
? Horde_Mime::decode($value)
|
||||
: null;
|
||||
break;
|
||||
@ -144,7 +144,7 @@ class Horde_Mail_Rfc822_Address extends Horde_Mail_Rfc822_Object
|
||||
: $this->_personal;
|
||||
|
||||
case 'personal':
|
||||
return (strcasecmp($this->_personal, $this->bare_address) === 0)
|
||||
return $this->_personal === null || (strcasecmp($this->_personal, $this->bare_address) === 0)
|
||||
? null
|
||||
: $this->_personal;
|
||||
|
||||
@ -152,7 +152,7 @@ class Horde_Mail_Rfc822_Address extends Horde_Mail_Rfc822_Object
|
||||
return Horde_Mime::encode($this->personal);
|
||||
|
||||
case 'valid':
|
||||
return (bool)strlen($this->mailbox);
|
||||
return !empty($this->mailbox);
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,11 +164,11 @@ class Horde_Mail_Rfc822_Address extends Horde_Mail_Rfc822_Object
|
||||
|
||||
$address = $rfc822->encode($this->mailbox, 'address');
|
||||
$host = empty($opts['idn']) ? $this->host : $this->host_idn;
|
||||
if (strlen($host)) {
|
||||
if (!empty($host)) {
|
||||
$address .= '@' . $host;
|
||||
}
|
||||
$personal = $this->personal;
|
||||
if (strlen($personal)) {
|
||||
if (!empty($personal)) {
|
||||
if (!empty($opts['encode'])) {
|
||||
$personal = Horde_Mime::encode($this->personal, $opts['encode']);
|
||||
}
|
||||
@ -182,7 +182,7 @@ class Horde_Mail_Rfc822_Address extends Horde_Mail_Rfc822_Object
|
||||
}
|
||||
}
|
||||
|
||||
return (strlen($personal) && ($personal != $address))
|
||||
return (!empty($personal) && ($personal != $address))
|
||||
? ltrim($personal) . ' <' . $address . '>'
|
||||
: $address;
|
||||
}
|
||||
|
@ -137,6 +137,7 @@ class Horde_Mail_Rfc822_Group
|
||||
*
|
||||
* @return integer The number of addresses.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->addresses);
|
||||
|
@ -44,11 +44,11 @@ class Horde_Mail_Rfc822_Identification extends Horde_Mail_Rfc822
|
||||
/**
|
||||
* Parse an identification header.
|
||||
*
|
||||
* @param string $value Identification field value to parse.
|
||||
* @param string|null $value Identification field value to parse.
|
||||
*/
|
||||
public function parse($value)
|
||||
{
|
||||
if (!strlen($value)) {
|
||||
if (empty($value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -331,6 +331,7 @@ class Horde_Mail_Rfc822_List
|
||||
|
||||
/**
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return !is_null($this[$offset]);
|
||||
@ -338,6 +339,7 @@ class Horde_Mail_Rfc822_List
|
||||
|
||||
/**
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
try {
|
||||
@ -350,6 +352,7 @@ class Horde_Mail_Rfc822_List
|
||||
|
||||
/**
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
if ($ob = $this[$offset]) {
|
||||
@ -367,6 +370,7 @@ class Horde_Mail_Rfc822_List
|
||||
|
||||
/**
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
if ($ob = $this[$offset]) {
|
||||
@ -387,6 +391,7 @@ class Horde_Mail_Rfc822_List
|
||||
*
|
||||
* @return integer The number of addresses.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->addresses);
|
||||
@ -394,6 +399,7 @@ class Horde_Mail_Rfc822_List
|
||||
|
||||
/* Iterator methods. */
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
if (!$this->valid()) {
|
||||
@ -407,11 +413,13 @@ class Horde_Mail_Rfc822_List
|
||||
: $ob->addresses[$this->_ptr['subidx']];
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return $this->_ptr['key'];
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function next()
|
||||
{
|
||||
if (is_null($this->_ptr['subidx'])) {
|
||||
@ -437,6 +445,7 @@ class Horde_Mail_Rfc822_List
|
||||
}
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
{
|
||||
$this->_ptr = array(
|
||||
@ -453,11 +462,13 @@ class Horde_Mail_Rfc822_List
|
||||
}
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function valid()
|
||||
{
|
||||
return (!empty($this->_ptr) && isset($this->_data[$this->_ptr['idx']]));
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function seek($position)
|
||||
{
|
||||
if (!$this->valid() ||
|
||||
@ -515,4 +526,14 @@ class Horde_Mail_Rfc822_List
|
||||
$this->_data = unserialize($data);
|
||||
}
|
||||
|
||||
public function __serialize() {
|
||||
return array(
|
||||
'data' => $this->_data
|
||||
);
|
||||
}
|
||||
|
||||
public function __unserialize(array $data) {
|
||||
$this->_data = $data['data'];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ abstract class Horde_Mail_Transport
|
||||
protected function _sanitizeHeaders($headers)
|
||||
{
|
||||
foreach (array_diff(array_keys($headers), array('_raw')) as $key) {
|
||||
$headers[$key] = preg_replace('=((<CR>|<LF>|0x0A/%0A|0x0D/%0D|\\n|\\r)\S).*=i', null, $headers[$key]);
|
||||
$headers[$key] = preg_replace('=((<CR>|<LF>|0x0A/%0A|0x0D/%0D|\\n|\\r)\S).*=i', '', $headers[$key]);
|
||||
}
|
||||
|
||||
return $headers;
|
||||
@ -251,7 +251,7 @@ abstract class Horde_Mail_Transport
|
||||
}
|
||||
}
|
||||
|
||||
if (!strlen($from)) {
|
||||
if (empty($from)) {
|
||||
throw new Horde_Mail_Exception('No from address provided.');
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ class Horde_Mime_Filter_Encoding extends php_user_filter
|
||||
/**
|
||||
* @see stream_filter_register()
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function onCreate()
|
||||
{
|
||||
$this->params->body = false;
|
||||
@ -44,6 +45,7 @@ class Horde_Mime_Filter_Encoding extends php_user_filter
|
||||
/**
|
||||
* @see stream_filter_register()
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function filter($in, $out, &$consumed, $closing)
|
||||
{
|
||||
while ($bucket = stream_bucket_make_writeable($in)) {
|
||||
|
@ -388,15 +388,41 @@ implements ArrayAccess, IteratorAggregate, Serializable
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
$data = array(
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialization.
|
||||
*
|
||||
* @return array Serialized data.
|
||||
*/
|
||||
public function __serialize(): array
|
||||
{
|
||||
return array(
|
||||
// Serialized data ID.
|
||||
self::VERSION,
|
||||
$this->_headers->getArrayCopy(),
|
||||
// TODO: BC
|
||||
$this->_eol
|
||||
);
|
||||
}
|
||||
|
||||
return serialize($data);
|
||||
/**
|
||||
* Unserialization.
|
||||
*
|
||||
* @param array $data Serialized data.
|
||||
*
|
||||
* @throws Horde_Mime_Exception
|
||||
*/
|
||||
public function __unserialize(array $data): void
|
||||
{
|
||||
if (!isset($data[0]) || ($data[0] != self::VERSION)) {
|
||||
throw new Horde_Mime_Exception('Cache version change');
|
||||
}
|
||||
|
||||
$this->_headers = new Horde_Support_CaseInsensitiveArray($data[1]);
|
||||
// TODO: BC
|
||||
$this->_eol = $data[2];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -409,15 +435,10 @@ implements ArrayAccess, IteratorAggregate, Serializable
|
||||
public function unserialize($data)
|
||||
{
|
||||
$data = @unserialize($data);
|
||||
if (!is_array($data) ||
|
||||
!isset($data[0]) ||
|
||||
($data[0] != self::VERSION)) {
|
||||
if (!is_array($data)) {
|
||||
throw new Horde_Mime_Exception('Cache version change');
|
||||
}
|
||||
|
||||
$this->_headers = new Horde_Support_CaseInsensitiveArray($data[1]);
|
||||
// TODO: BC
|
||||
$this->_eol = $data[2];
|
||||
$this->__unserialize($data);
|
||||
}
|
||||
|
||||
/* ArrayAccess methods. */
|
||||
@ -431,6 +452,7 @@ implements ArrayAccess, IteratorAggregate, Serializable
|
||||
*
|
||||
* @return boolean True if header exists.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->_headers[trim($offset)]);
|
||||
@ -446,6 +468,7 @@ implements ArrayAccess, IteratorAggregate, Serializable
|
||||
* @return Horde_Mime_Headers_Element Element object, or null if not
|
||||
* found.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->_headers[trim($offset)];
|
||||
@ -459,6 +482,7 @@ implements ArrayAccess, IteratorAggregate, Serializable
|
||||
* @param string $offset Not used.
|
||||
* @param Horde_Mime_Headers_Element $elt Header element.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->addHeaderOb($value);
|
||||
@ -471,6 +495,7 @@ implements ArrayAccess, IteratorAggregate, Serializable
|
||||
*
|
||||
* @param string $offset Header name.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->_headers[trim($offset)]);
|
||||
@ -481,6 +506,7 @@ implements ArrayAccess, IteratorAggregate, Serializable
|
||||
/**
|
||||
* @since 2.5.0
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->_headers);
|
||||
|
@ -368,6 +368,7 @@ implements ArrayAccess, Horde_Mime_Headers_Extension_Mime, Serializable
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->_params[$offset]);
|
||||
@ -375,6 +376,7 @@ implements ArrayAccess, Horde_Mime_Headers_Extension_Mime, Serializable
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->_params[$offset];
|
||||
@ -382,6 +384,7 @@ implements ArrayAccess, Horde_Mime_Headers_Extension_Mime, Serializable
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->_params[$offset] = $this->_sanityCheck($value);
|
||||
@ -389,6 +392,7 @@ implements ArrayAccess, Horde_Mime_Headers_Extension_Mime, Serializable
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->_params[$offset]);
|
||||
@ -397,22 +401,36 @@ implements ArrayAccess, Horde_Mime_Headers_Extension_Mime, Serializable
|
||||
/* Serializable methods */
|
||||
|
||||
/**
|
||||
* Serialize (until PHP 7.3)
|
||||
*
|
||||
* @return string serialized object state
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize (PHP 7.4+)
|
||||
*
|
||||
* @return array object state
|
||||
*/
|
||||
public function __serialize(): array
|
||||
{
|
||||
$vars = array_filter(get_object_vars($this));
|
||||
if (isset($vars['_params'])) {
|
||||
$vars['_params'] = $vars['_params']->getArrayCopy();
|
||||
}
|
||||
return serialize($vars);
|
||||
return $vars;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unserialize (PHP 7.4+)
|
||||
*
|
||||
* @param array $data
|
||||
*/
|
||||
public function unserialize($data)
|
||||
public function __unserialize(array $data): void
|
||||
{
|
||||
$data = unserialize($data);
|
||||
|
||||
foreach ($data as $key => $val) {
|
||||
switch ($key) {
|
||||
case '_params':
|
||||
@ -426,4 +444,14 @@ implements ArrayAccess, Horde_Mime_Headers_Extension_Mime, Serializable
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unserialize (until PHP 7.3)
|
||||
*
|
||||
* @param string $data
|
||||
*/
|
||||
public function unserialize($data)
|
||||
{
|
||||
$this->__unserialize(unserialize($data));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -90,6 +90,7 @@ extends Horde_Mime_Headers_ContentParam
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
if (strcasecmp($offset, 'size') === 0) {
|
||||
|
@ -142,6 +142,9 @@ implements IteratorAggregate
|
||||
}
|
||||
|
||||
/* Ensure no null characters exist in header data. */
|
||||
if ($data === null) {
|
||||
return '';
|
||||
}
|
||||
return str_replace("\0", '', $data);
|
||||
}
|
||||
|
||||
@ -173,6 +176,7 @@ implements IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->_values);
|
||||
|
@ -2229,6 +2229,7 @@ implements ArrayAccess, Countable, RecursiveIterator, Serializable
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return ($this[$offset] !== null);
|
||||
@ -2236,6 +2237,7 @@ implements ArrayAccess, Countable, RecursiveIterator, Serializable
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
$this->_reindex();
|
||||
@ -2261,6 +2263,7 @@ implements ArrayAccess, Countable, RecursiveIterator, Serializable
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
if (is_null($offset)) {
|
||||
@ -2280,6 +2283,7 @@ implements ArrayAccess, Countable, RecursiveIterator, Serializable
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
if ($part = $this[$offset]) {
|
||||
@ -2303,6 +2307,7 @@ implements ArrayAccess, Countable, RecursiveIterator, Serializable
|
||||
*
|
||||
* @return integer Number of message parts.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->_parts);
|
||||
@ -2313,6 +2318,7 @@ implements ArrayAccess, Countable, RecursiveIterator, Serializable
|
||||
/**
|
||||
* @since 2.8.0
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
return (($key = $this->key()) === null)
|
||||
@ -2323,6 +2329,7 @@ implements ArrayAccess, Countable, RecursiveIterator, Serializable
|
||||
/**
|
||||
* @since 2.8.0
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return (isset($this->_temp['iterate']) && isset($this->_parts[$this->_temp['iterate']]))
|
||||
@ -2333,6 +2340,7 @@ implements ArrayAccess, Countable, RecursiveIterator, Serializable
|
||||
/**
|
||||
* @since 2.8.0
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function next()
|
||||
{
|
||||
++$this->_temp['iterate'];
|
||||
@ -2341,6 +2349,7 @@ implements ArrayAccess, Countable, RecursiveIterator, Serializable
|
||||
/**
|
||||
* @since 2.8.0
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
{
|
||||
$this->_reindex();
|
||||
@ -2351,6 +2360,7 @@ implements ArrayAccess, Countable, RecursiveIterator, Serializable
|
||||
/**
|
||||
* @since 2.8.0
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function valid()
|
||||
{
|
||||
return ($this->key() !== null);
|
||||
@ -2359,6 +2369,7 @@ implements ArrayAccess, Countable, RecursiveIterator, Serializable
|
||||
/**
|
||||
* @since 2.8.0
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function hasChildren()
|
||||
{
|
||||
return (($curr = $this->current()) && count($curr));
|
||||
@ -2367,6 +2378,7 @@ implements ArrayAccess, Countable, RecursiveIterator, Serializable
|
||||
/**
|
||||
* @since 2.8.0
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getChildren()
|
||||
{
|
||||
return $this->current();
|
||||
@ -2380,6 +2392,11 @@ implements ArrayAccess, Countable, RecursiveIterator, Serializable
|
||||
* @return string Serialized data.
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
public function __serialize(): array
|
||||
{
|
||||
$data = array(
|
||||
// Serialized data ID.
|
||||
@ -2399,22 +2416,12 @@ implements ArrayAccess, Countable, RecursiveIterator, Serializable
|
||||
$data[] = $this->_readStream($this->_contents);
|
||||
}
|
||||
|
||||
return serialize($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unserialization.
|
||||
*
|
||||
* @param string $data Serialized data.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function unserialize($data)
|
||||
public function __unserialize(array $data): void
|
||||
{
|
||||
$data = @unserialize($data);
|
||||
if (!is_array($data) ||
|
||||
!isset($data[0]) ||
|
||||
($data[0] != self::VERSION)) {
|
||||
if (!isset($data[0]) || ($data[0] != self::VERSION)) {
|
||||
switch ($data[0]) {
|
||||
case 1:
|
||||
$convert = new Horde_Mime_Part_Upgrade_V1($data);
|
||||
@ -2447,6 +2454,19 @@ implements ArrayAccess, Countable, RecursiveIterator, Serializable
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unserialization.
|
||||
*
|
||||
* @param string $data Serialized data.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function unserialize($data)
|
||||
{
|
||||
$data = @unserialize($data);
|
||||
$this->__unserialize($data);
|
||||
}
|
||||
|
||||
/* Deprecated elements. */
|
||||
|
||||
/**
|
||||
|
@ -62,6 +62,7 @@ implements Countable, Iterator
|
||||
*
|
||||
* @return integer Number of message parts.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count(iterator_to_array($this));
|
||||
@ -71,6 +72,7 @@ implements Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
return $this->valid()
|
||||
@ -80,6 +82,7 @@ implements Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return ($curr = $this->current())
|
||||
@ -89,6 +92,7 @@ implements Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function next()
|
||||
{
|
||||
if (!isset($this->_state)) {
|
||||
@ -115,6 +119,7 @@ implements Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
{
|
||||
$this->_state = new stdClass;
|
||||
@ -129,6 +134,7 @@ implements Countable, Iterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function valid()
|
||||
{
|
||||
return !empty($this->_state);
|
||||
|
@ -153,6 +153,7 @@ class Horde_Mime_Related implements IteratorAggregate
|
||||
|
||||
/* IteratorAggregate method. */
|
||||
|
||||
#[ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->_cids);
|
||||
|
@ -114,6 +114,7 @@ class Horde_Mime_Uudecode implements Countable, IteratorAggregate
|
||||
|
||||
/* Countable method. */
|
||||
|
||||
#[ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->_data);
|
||||
@ -121,6 +122,7 @@ class Horde_Mime_Uudecode implements Countable, IteratorAggregate
|
||||
|
||||
/* IteratorAggregate method. */
|
||||
|
||||
#[ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->_data);
|
||||
|
@ -144,7 +144,8 @@ class Client
|
||||
{
|
||||
if ($this->connected && !$this->secure) {
|
||||
if (defined('STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT')) {
|
||||
$mode = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT
|
||||
$mode = STREAM_CRYPTO_METHOD_TLS_CLIENT
|
||||
| STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT
|
||||
| STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT
|
||||
| STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
|
||||
} else {
|
||||
|
@ -600,21 +600,40 @@ class Horde_Stream implements Serializable
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
$this->_params['_pos'] = $this->pos();
|
||||
|
||||
return json_encode(array(
|
||||
strval($this),
|
||||
$this->_params
|
||||
));
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function unserialize($data)
|
||||
{
|
||||
$this->_init();
|
||||
$data = @unserialize($data, true);
|
||||
if ($data == null || !is_array($data)) {
|
||||
throw new Exception('Cache version change.');
|
||||
}
|
||||
$this->__unserialize($data);
|
||||
}
|
||||
|
||||
$data = json_decode($data, true);
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
$this->_params['_pos'] = $this->pos();
|
||||
|
||||
return array(
|
||||
strval($this),
|
||||
$this->_params
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function __unserialize($data)
|
||||
{
|
||||
$this->_init();
|
||||
$this->add($data[0]);
|
||||
$this->seek($data[1]['_pos'], false);
|
||||
unset($data[1]['_pos']);
|
||||
|
@ -22,6 +22,7 @@ class Horde_Stream_Filter_Bin2hex extends php_user_filter
|
||||
/**
|
||||
* @see stream_filter_register()
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function filter($in, $out, &$consumed, $closing)
|
||||
{
|
||||
while ($bucket = stream_bucket_make_writeable($in)) {
|
||||
|
@ -28,6 +28,7 @@ class Horde_Stream_Filter_Crc32 extends php_user_filter
|
||||
/**
|
||||
* @see stream_filter_register()
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function onCreate()
|
||||
{
|
||||
$this->params->crc32 = 0;
|
||||
@ -38,6 +39,7 @@ class Horde_Stream_Filter_Crc32 extends php_user_filter
|
||||
/**
|
||||
* @see stream_filter_register()
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function filter($in, $out, &$consumed, $closing)
|
||||
{
|
||||
while ($bucket = stream_bucket_make_writeable($in)) {
|
||||
|
@ -56,6 +56,7 @@ class Horde_Stream_Filter_Eol extends php_user_filter
|
||||
/**
|
||||
* @see stream_filter_register()
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function onCreate()
|
||||
{
|
||||
$eol = isset($this->params['eol'])
|
||||
@ -82,6 +83,7 @@ class Horde_Stream_Filter_Eol extends php_user_filter
|
||||
/**
|
||||
* @see stream_filter_register()
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function filter($in, $out, &$consumed, $closing)
|
||||
{
|
||||
while ($bucket = stream_bucket_make_writeable($in)) {
|
||||
|
@ -27,6 +27,7 @@ class Horde_Stream_Filter_Htmlspecialchars extends php_user_filter
|
||||
/**
|
||||
* @see stream_filter_register()
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function filter($in, $out, &$consumed, $closing)
|
||||
{
|
||||
while ($bucket = stream_bucket_make_writeable($in)) {
|
||||
|
@ -41,6 +41,7 @@ class Horde_Stream_Filter_Null extends php_user_filter
|
||||
/**
|
||||
* @see stream_filter_register()
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function onCreate()
|
||||
{
|
||||
$this->_replace = isset($this->params->replace)
|
||||
@ -53,6 +54,7 @@ class Horde_Stream_Filter_Null extends php_user_filter
|
||||
/**
|
||||
* @see stream_filter_register()
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function filter($in, $out, &$consumed, $closing)
|
||||
{
|
||||
while ($bucket = stream_bucket_make_writeable($in)) {
|
||||
|
@ -251,28 +251,42 @@ class Horde_Stream_TempString extends Horde_Stream_Temp
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
if ($this->_string) {
|
||||
$data = array(
|
||||
$this->_string,
|
||||
$this->_params
|
||||
);
|
||||
} else {
|
||||
$data = parent::serialize();
|
||||
}
|
||||
|
||||
return serialize($data);
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function unserialize($data)
|
||||
{
|
||||
$data = unserialize($data);
|
||||
$this->__unserialize(unserialize($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
if ($this->_string) {
|
||||
return array(
|
||||
$this->_string,
|
||||
$this->_params
|
||||
);
|
||||
} else {
|
||||
return parent::__serialize();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function __unserialize($data)
|
||||
{
|
||||
if ($data[0] instanceof Horde_Stream_String) {
|
||||
$this->_string = $data[0];
|
||||
$this->_params = $data[1];
|
||||
} else {
|
||||
parent::unserialize($data);
|
||||
parent::__unserialize($data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,9 +171,11 @@ class Horde_Stream_Wrapper_Combine
|
||||
}
|
||||
|
||||
$curr_read = min($count, $tmp['l'] - $tmp['p']);
|
||||
$out .= fread($tmp['fp'], $curr_read);
|
||||
$count -= $curr_read;
|
||||
$this->_position += $curr_read;
|
||||
if ($curr_read > 0) {
|
||||
$out .= fread($tmp['fp'], $curr_read);
|
||||
$count -= $curr_read;
|
||||
$this->_position += $curr_read;
|
||||
}
|
||||
|
||||
if ($this->_position == $this->_length) {
|
||||
if ($count) {
|
||||
|
@ -157,9 +157,13 @@ class Horde_String
|
||||
|
||||
/* Try mbstring. */
|
||||
if (Horde_Util::extensionExists('mbstring')) {
|
||||
$out = @mb_convert_encoding($input, $to, self::_mbstringCharset($from));
|
||||
if (!empty($out)) {
|
||||
return $out;
|
||||
try {
|
||||
$out = @mb_convert_encoding($input, $to, self::_mbstringCharset($from));
|
||||
if (!empty($out)) {
|
||||
return $out;
|
||||
}
|
||||
} catch (ValueError $e) {
|
||||
// catch error thrown under PHP 8.0, if mbstring does not support the encoding
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,7 +199,11 @@ class Horde_String
|
||||
if (!isset(self::$_lowers[$string])) {
|
||||
$language = setlocale(LC_CTYPE, 0);
|
||||
setlocale(LC_CTYPE, 'C');
|
||||
self::$_lowers[$string] = strtolower($string);
|
||||
if ($string === null) {
|
||||
self::$_lowers[$string] = '';
|
||||
} else {
|
||||
self::$_lowers[$string] = strtolower($string);
|
||||
}
|
||||
setlocale(LC_CTYPE, $language);
|
||||
}
|
||||
|
||||
|
@ -146,6 +146,7 @@ class Horde_Support_Array implements ArrayAccess, Countable, IteratorAggregate
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->_array);
|
||||
@ -153,6 +154,7 @@ class Horde_Support_Array implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->_array);
|
||||
@ -163,6 +165,7 @@ class Horde_Support_Array implements ArrayAccess, Countable, IteratorAggregate
|
||||
*
|
||||
* @see __get()
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->__get($offset);
|
||||
@ -173,6 +176,7 @@ class Horde_Support_Array implements ArrayAccess, Countable, IteratorAggregate
|
||||
*
|
||||
* @see __set()
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
return $this->__set($offset, $value);
|
||||
@ -183,6 +187,7 @@ class Horde_Support_Array implements ArrayAccess, Countable, IteratorAggregate
|
||||
*
|
||||
* @see __isset()
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return $this->__isset($offset);
|
||||
@ -193,6 +198,7 @@ class Horde_Support_Array implements ArrayAccess, Countable, IteratorAggregate
|
||||
*
|
||||
* @see __unset()
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
return $this->__unset($offset);
|
||||
|
@ -24,6 +24,7 @@ class Horde_Support_CaseInsensitiveArray extends ArrayIterator
|
||||
{
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return (is_null($offset = $this->_getRealOffset($offset)))
|
||||
@ -33,6 +34,7 @@ class Horde_Support_CaseInsensitiveArray extends ArrayIterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
if (is_null($roffset = $this->_getRealOffset($offset))) {
|
||||
@ -44,6 +46,7 @@ class Horde_Support_CaseInsensitiveArray extends ArrayIterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return !is_null($offset = $this->_getRealOffset($offset));
|
||||
@ -51,6 +54,7 @@ class Horde_Support_CaseInsensitiveArray extends ArrayIterator
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
if (!is_null($offset = $this->_getRealOffset($offset))) {
|
||||
|
@ -57,7 +57,7 @@ class Horde_Support_Guid
|
||||
. (isset($opts['prefix']) ? $opts['prefix'] . '.' : '')
|
||||
. strval(new Horde_Support_Randomid())
|
||||
. '@'
|
||||
. (isset($opts['server']) ? $opts['server'] : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost'));
|
||||
. (isset($opts['server']) ? $opts['server'] : (!empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -95,6 +95,7 @@ class Horde_Support_Stub implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return null;
|
||||
@ -102,12 +103,14 @@ class Horde_Support_Stub implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return false;
|
||||
@ -115,6 +118,7 @@ class Horde_Support_Stub implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
}
|
||||
@ -123,6 +127,7 @@ class Horde_Support_Stub implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return 0;
|
||||
@ -132,6 +137,7 @@ class Horde_Support_Stub implements ArrayAccess, Countable, IteratorAggregate
|
||||
|
||||
/**
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator(array());
|
||||
|
@ -13,6 +13,10 @@ Description of import of Horde libraries
|
||||
passing in your path to Horde (the directory you've cloned the repository):
|
||||
/tmp/copyhorde.sh ~/git/base/directory/from/step/2
|
||||
|
||||
|
||||
Notes:
|
||||
* 2023-01-20 Horde/Mail is copied from https://github.com/bytestream/Mail/tree/v2.7.1 for PHP 8.1 compatibility
|
||||
|
||||
====
|
||||
#!/bin/sh
|
||||
|
||||
@ -36,8 +40,3 @@ do
|
||||
cp -Rf $locale/* $target/locale
|
||||
fi
|
||||
done
|
||||
|
||||
Local modifications:
|
||||
- lib/Horde/Imap/Client/Exception/ServerResponse.php has been minimally modified for php80 compatibility
|
||||
The fix applied is already upstream, see https://github.com/horde/Imap_Client/pull/13 and it's available
|
||||
in Imap_Client 2.30.4 and up. See MDL-73405 for more details.
|
||||
|
Loading…
x
Reference in New Issue
Block a user